module Jennifer::Model::Scoping

Direct including types

Defined in:

jennifer/model/scoping.cr

Macro Summary

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

[View source]
macro scope(name, klass) #

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

[View source]