Module: Autosuggest::Mongoid
- Defined in:
- lib/autosuggest/helpers.rb
Class Method Summary collapse
Class Method Details
.query(options) ⇒ Object
9 10 11 |
# File 'lib/autosuggest/helpers.rb', line 9 def self.query() [:object].where([:name].to_sym => /.*#{[:query]}.*/i).limit([:limit]).order_by(resolve_order_syntax([:order])) end |
.resolve_order_syntax(order) ⇒ Object
13 14 15 16 |
# File 'lib/autosuggest/helpers.rb', line 13 def self.resolve_order_syntax(order) fields = order.split [fields[0], fields[1].downcase.to_sym] end |