Module: EacRailsUtils::Models::InequalityQueries::ClassMethods

Defined in:
lib/eac_rails_utils/models/inequality_queries.rb

Instance Method Summary collapse

Instance Method Details

#add_inequality_queries(attribute) ⇒ Object


29
30
31
32
33
34
35
# File 'lib/eac_rails_utils/models/inequality_queries.rb', line 29

def add_inequality_queries(attribute)
  %w[gt gteq lt lteq].each do |ineq|
    scope "by_#{attribute}_#{ineq}", lambda { |v|
      where(arel_table[attribute].send(ineq, v))
    }
  end
end