Module: SnFoil::Searcher
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/sn_foil/searcher.rb
Instance Method Summary collapse
- #distinct? ⇒ Boolean
- #included_params ⇒ Object
- #order(params = {}) ⇒ Object
- #order_by(params = {}) ⇒ Object
Instance Method Details
#distinct? ⇒ Boolean
48 49 50 |
# File 'lib/sn_foil/searcher.rb', line 48 def distinct? self.class.i_is_distinct || false end |
#included_params ⇒ Object
52 53 54 |
# File 'lib/sn_foil/searcher.rb', line 52 def included_params self.class.i_include_params end |
#order(params = {}) ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/sn_foil/searcher.rb', line 65 def order(params = {}) if params[:order].present? params[:order] = params[:order].to_s.upcase return params[:order] if params[:order].eql?(ASC) || params[:order].eql?(DESC) end self.class.i_order_by_direction || ASC end |
#order_by(params = {}) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/sn_foil/searcher.rb', line 56 def order_by(params = {}) if params[:order_by].present? params[:order_by] = params[:order_by].to_s.underscore return params[:order_by].to_sym if model.attribute_names.include?(params[:order_by]) end self.class.i_order_by_attr || :id end |