Module: Eac::InequalityQueries
- Defined in:
- lib/eac/inequality_queries.rb
Overview
Example:
Note: model Product has a attribute “foo” Date, Time or Number:
class Product
include ::Eac::InequalityQueries
add_inequality_queries(:foo)
end
This add the following scopes:
Product.by_foo_gt(value) # Equivalent to Product.where("foo > ?", value)
Product.by_foo_gteq(value) # Equivalent to Product.where("foo >= ?", value)
Product.by_foo_lt(value) # Equivalent to Product.where("foo < ?", value)
Product.by_foo_lteq(value) # Equivalent to Product.where("foo <= ?", value)
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
21 22 23 |
# File 'lib/eac/inequality_queries.rb', line 21 def included(base) base.extend(ClassMethods) end |