module Jennifer::Model::Scoping
Direct including types
Defined in:
jennifer/model/scoping.crMacro Summary
-
scope(name, &block)
Adds a class method for retrieving and querying objects.
-
scope(name, klass)
Adds a class method for retrieving and querying objects.
Macro Detail
macro scope(name, &block)
#
Adds a class method for retrieving and querying objects.
A .scope
presents a narrowing of a database query, such as
where { _color == "red" }.includes(:washing_instructions)
.
class Shirt < Jennifer::Model::Base
# ...
scope :red { where { _color == "red" } }
end