Class: Symphonia::ModelFilters::BooleanFilter
- Defined in:
- lib/symphonia/model_filters/boolean_filter.rb
Instance Attribute Summary
Attributes inherited from Base
#caption, #name, #operator, #options, #query, #type, #value
Instance Method Summary collapse
Methods inherited from Base
#active?, #initialize, #inspect
Constructor Details
This class inherits a constructor from Symphonia::ModelFilters::Base
Instance Method Details
#apply(scope) ⇒ Object
13 14 15 16 17 |
# File 'lib/symphonia/model_filters/boolean_filter.rb', line 13 def apply(scope) super t = scope.arel_table scope.where(t[name].send(operator, true)) end |
#form_field(_c) ⇒ Object
19 20 21 |
# File 'lib/symphonia/model_filters/boolean_filter.rb', line 19 def form_field(_c) _c.text_field_tag(form_field_name, @query.active_filters[name], class: 'form-control') end |
#operator=(o) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/symphonia/model_filters/boolean_filter.rb', line 5 def operator=(o) if o == '!' @operator = 'not_eq' else @operator = 'eq' end end |