data Rotor::Association(kind: Symbol, name: Symbol, target: Type[Rotor::Model], foreign_key: Symbol, through: Type[Rotor::Model]?, source: Symbol?)
An association of a model, as its table block declares it: what the
queries of a later version follow.
/home/runner/work/rotor/rotor/src/column.qz:26
Methods
def to_h -> Hash[Symbol, Object]
The fields as a Hash, by name.
def with(*, kind: Symbol = …, name: Symbol = …, target: Type[Rotor::Model] = …, foreign_key: Symbol = …, through: Type[Rotor::Model]? = …, source: Symbol? = …) -> Rotor::Association
A copy with the fields given replaced.
def kind -> Symbol
:belongs_to or :has_many.
def name -> Symbol
Its name: :account for belongs_to Account, :posts for
has_many Post.
def target -> Type[Rotor::Model]
The associated model's class.
def foreign_key -> Symbol
The column that holds the key: this model's for belongs_to
(account_id), the other's for has_many (user_id); for a
has_many through a join model, the default has_many would have,
unused (the keys are the join model's, Rotor::Through.keys).
def through -> Type[Rotor::Model]?
The join model of a has_many ..., through:, or nil.
def source -> Symbol?
The join model's belongs_to to the target that source: names, or
nil (the one whose target is the association's class).