Class: Toller::Sorts::ColumnHandler
- Inherits:
-
Object
- Object
- Toller::Sorts::ColumnHandler
- Defined in:
- lib/toller/sorts/column_handler.rb
Overview
Column handler for filter
Instance Method Summary collapse
-
#call(collection, type, direction, properties) ⇒ ActiveRecord::Relation
Applies a plain
orderclause tocollectionfor a non-scope sort.
Instance Method Details
#call(collection, type, direction, properties) ⇒ ActiveRecord::Relation
Applies a plain order clause to collection for a non-scope sort.
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 sort is logged and skipped instead of raising
once the relation is evaluated.
22 23 24 25 26 27 28 |
# File 'lib/toller/sorts/column_handler.rb', line 22 def call(collection, type, direction, properties) field_name = properties[:field] return collection unless resolvable_column?(collection, field_name, type) collection.order(field_name => direction) end |