Class: Toller::Sorts::ScopeHandler
- Inherits:
-
Object
- Object
- Toller::Sorts::ScopeHandler
- Defined in:
- lib/toller/sorts/scope_handler.rb
Overview
Scope handler for sort
Instance Method Summary collapse
-
#call(collection, direction, properties) ⇒ ActiveRecord::Relation
Applies a named scope to
collectionfor atype: :scopesort.
Instance Method Details
#call(collection, direction, properties) ⇒ ActiveRecord::Relation
Applies a named scope to collection for a type: :scope sort.
16 17 18 19 20 |
# File 'lib/toller/sorts/scope_handler.rb', line 16 def call(collection, direction, properties) scoped_name = properties[:scope_name] || properties[:field] collection.public_send(scoped_name, direction) end |