diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2019-01-17 17:35:23 +0300 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2019-01-24 20:44:09 +0300 |
commit | 22eb2e4c227b060981bb37708222cdd07e825542 (patch) | |
tree | c02c037a5877e1f7075a99806336fef8cb3b03bc /app/models/milestone.rb | |
parent | e520a946410ca0007a2a562f2c2a7c6f8c6f1dab (diff) |
Adds milestone search
Adds to search ILIKE search for milestones title in:
- Milestones dashboard
- Group milestones page
- Project milestones page
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r-- | app/models/milestone.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb index b21edce3aad..7ee7da99606 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -77,7 +77,7 @@ class Milestone < ActiveRecord::Base alias_attribute :name, :title class << self - # Searches for milestones matching the given query. + # Searches for milestones with a matching title or description. # # This method uses ILIKE on PostgreSQL and LIKE on MySQL. # @@ -88,6 +88,17 @@ class Milestone < ActiveRecord::Base fuzzy_search(query, [:title, :description]) end + # Searches for milestones with a matching title. + # + # This method uses ILIKE on PostgreSQL and LIKE on MySQL. + # + # query - The search query as a String + # + # Returns an ActiveRecord::Relation. + def search_title(query) + fuzzy_search(query, [:title]) + end + def filter_by_state(milestones, state) case state when 'closed' then milestones.closed |