Module: Syto::ClassMethods
- Defined in:
- lib/syto.rb
Overview
Class methods for Syto
Instance Method Summary collapse
-
#attrs_map ⇒ Object
Getter for @syto_attrs_map.
-
#filter_by(params) ⇒ ActiveRecord::Relation
Filtering method.
-
#syto_filters_attrs_map(*attrs_map) ⇒ Object
Define map of filterable attributes.
-
#syto_filters_class(filter_klass) ⇒ Object
Set class with customized filter settings.
Instance Method Details
#attrs_map ⇒ Object
Getter for @syto_attrs_map
63 64 65 |
# File 'lib/syto.rb', line 63 def attrs_map @syto_attrs_map end |
#filter_by(params) ⇒ ActiveRecord::Relation
Filtering method
73 74 75 76 77 78 |
# File 'lib/syto.rb', line 73 def filter_by(params) return all if params.blank? || params.empty? @filter_klass ||= Syto::Base @filter_klass.new(self, all, params.symbolize_keys).perform end |
#syto_filters_attrs_map(*attrs_map) ⇒ Object
Define map of filterable attributes
57 58 59 |
# File 'lib/syto.rb', line 57 def syto_filters_attrs_map(*attrs_map) @syto_attrs_map = attrs_map end |
#syto_filters_class(filter_klass) ⇒ Object
Set class with customized filter settings
49 50 51 |
# File 'lib/syto.rb', line 49 def syto_filters_class(filter_klass) @filter_klass = filter_klass end |