Module: Sphinxsearchlogic::Search::Implementation
- Defined in:
- lib/sphinxsearchlogic.rb
Instance Method Summary collapse
-
#sphinxsearchlogic(conditions = {}, pagination = {}) ⇒ Object
Use like: Movie.sphinxsearchlogic(params, :page => params, :per_page => [:per_page]).
Instance Method Details
#sphinxsearchlogic(conditions = {}, pagination = {}) ⇒ Object
Use like:
Movie.sphinxsearchlogic(params[:search], :page => params[:page], :per_page => [:per_page])
10 11 12 13 14 15 16 |
# File 'lib/sphinxsearchlogic.rb', line 10 def sphinxsearchlogic(conditions = {}, pagination = {}) conditions ||= {} # params[:search] might be nil conditions.merge!(pagination) # Merge array of hashes, but doesn't work if Hash value is an Array. # conditions = Hash[*args.collect {|h| h.to_a}.flatten] Search.new(self, scope(:find), conditions) end |