我正在对要传递活动存储对象的模型使用composited_of,但是它设置为nil
composed_of :constitutive_act,
class_name: 'ConstitutiveAct',
allow_nil: false,
mapping: [
['constitutive_act_person_name', 'person_name'],
['constitutive_act_number', 'number'],
['constitutive_act_date', 'date'],
['constitutive_act_document', 'document'],
]
class ConstitutiveAct
attr_accessor(
:person_name,
:number,
:date,
:document
)
def initialize(person_name, number, date, document)
@person_name = person_name
@number = number
@date = date
@document = document
end
constitutive_act.constitutive_act.document
返回nil,但是存在constitutive_act_document属性并进行调整