Class: Right::RansackableFilter
- Inherits:
-
Object
- Object
- Right::RansackableFilter
- Defined in:
- lib/right/ransackable_filter.rb
Instance Method Summary collapse
-
#call(env) ⇒ <ActiveRecord::Relation, Hash]
<ActiveRecord::Relation, Hash].
-
#initialize(app) ⇒ RansackableFilter
constructor
A new instance of RansackableFilter.
Constructor Details
#initialize(app) ⇒ RansackableFilter
Returns a new instance of RansackableFilter.
6 7 8 |
# File 'lib/right/ransackable_filter.rb', line 6 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ <ActiveRecord::Relation, Hash]
Returns <ActiveRecord::Relation, Hash].
15 16 17 18 19 |
# File 'lib/right/ransackable_filter.rb', line 15 def call(env) scope, params = env filtered_scope = scope.ransack(params[:filter]).result app.call([filtered_scope, params]) end |