module ObjectFramework::Persistence::AssociationDSL
Explicit association declarations used by Mapping.
Public Instance Methods
Source
# File lib/object_framework/persistence/mapping.rb, line 23
Declares a reference to target, storing its UUID in foreign_key on this mapping’s table. The target must have a registered Mapping. Optional read and write callables replace public attribute accessors. Returns self. Associations load only when requested through a Session#find or Session#query load plan.
belongs_to :customer, target: Customer, foreign_key: :customer_id
Source
# File lib/object_framework/persistence/mapping.rb, line 35
Declares a collection of target entities whose foreign_key refers to this entity’s UUID. The target mapping must expose that foreign key as a field or a belongs-to association. Optional read and write callables replace public attribute accessors. Returns self. Collections load only through an explicit session load plan.
has_many :purchases, target: Purchase, foreign_key: :customer_id