Module: SearchExtension::ClassMethods
- Defined in:
- app/models/concerns/search_extension.rb
Instance Method Summary collapse
Instance Method Details
#build_query_string(params = {}) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/models/concerns/search_extension.rb', line 29 def build_query_string(params = {}) query_str = params[:query].strip query_str = "%#{query_str}" if ['contains', 'ends_with'].include?(params[:query_type].to_s) query_str = "#{query_str}%" if ['contains', 'begins_with'].include?(params[:query_type].to_s) # Note that 'contains' will add an '%' to the beginning AND to the end query_str end |
#single_query(params = {}) ⇒ Object
25 26 27 |
# File 'app/models/concerns/search_extension.rb', line 25 def single_query(params = {}) raise NotImplementedError.new("Implement self.single_query in your specific class (#{self.name}) that should be searchable!") end |