Module: Filterable::Datable::Before
- Defined in:
- lib/filterable/datable/before.rb
Overview
Keeps rows whose datable attribute is strictly before the bound.
Reads filters[<attribute>][before].
Class Method Summary collapse
-
.call(params, scope) ⇒ ActiveRecord::Relation
private
Narrows the scope to rows strictly before each declared attribute's
beforebound.
Class Method Details
.call(params, scope) ⇒ ActiveRecord::Relation
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Narrows the scope to rows strictly before each declared attribute's before bound.
16 17 18 19 20 21 22 23 |
# File 'lib/filterable/datable/before.rb', line 16 def call(params, scope) Filterable::Datable.columns(params, scope).reduce(scope) do |sub_scope, (column, bounds)| before = Filterable::Datable.parse(bounds[:before]) next sub_scope unless before sub_scope.where(scope.arel_table[column].lt(before)) end end |