Class: Toller::Filters::ColumnHandler
- Inherits:
-
Object
- Object
- Toller::Filters::ColumnHandler
- Defined in:
- lib/toller/filters/column_handler.rb
Overview
Column handler for filter
Instance Method Summary collapse
-
#call(collection, type, value, properties) ⇒ ActiveRecord::Relation
Applies a plain
whereclause tocollectionfor a non-scope filter.
Instance Method Details
#call(collection, type, value, properties) ⇒ ActiveRecord::Relation
Applies a plain where clause to collection for a non-scope filter.
If field isn't a real column on the collection's model, or the column's actual type
doesn't match the declared type:, the filter is logged and skipped instead of raising
(or silently applying a mismatched mutator) once the relation is evaluated.
22 23 24 25 26 27 28 29 30 |
# File 'lib/toller/filters/column_handler.rb', line 22 def call(collection, type, value, properties) field_name = properties[:field] return collection unless resolvable_column?(collection, field_name, type) mutated_value = value_mutator(type, value) collection.where(field_name => mutated_value) end |