Module: Filterable::Datable::Since
- Defined in:
- lib/filterable/datable/since.rb
Overview
Keeps rows whose datable attribute is on or before the bound (inclusive).
Reads filters[<attribute>][since].
Class Method Summary collapse
-
.call(params, scope) ⇒ ActiveRecord::Relation
private
Narrows the scope to rows on or before each declared attribute's
sincebound.
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 on or before each declared attribute's since bound.
16 17 18 19 20 21 22 23 |
# File 'lib/filterable/datable/since.rb', line 16 def call(params, scope) Filterable::Datable.columns(params, scope).reduce(scope) do |sub_scope, (column, bounds)| since = Filterable::Datable.parse(bounds[:since]) next sub_scope unless since sub_scope.where(scope.arel_table[column].lteq(since)) end end |