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.

/home/runner/work/rotor/rotor/src/column.qz:26

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.

/home/runner/work/rotor/rotor/src/column.qz:26

def kind -> Symbol

:belongs_to or :has_many.

/home/runner/work/rotor/rotor/src/column.qz:28

def name -> Symbol

Its name: :account for belongs_to Account, :posts for has_many Post.

/home/runner/work/rotor/rotor/src/column.qz:31

def target -> Type[Rotor::Model]

The associated model's class.

/home/runner/work/rotor/rotor/src/column.qz:33

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).

/home/runner/work/rotor/rotor/src/column.qz:38

def through -> Type[Rotor::Model]?

The join model of a has_many ..., through:, or nil.

/home/runner/work/rotor/rotor/src/column.qz:40

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).

/home/runner/work/rotor/rotor/src/column.qz:43