如果我有一个名为的表enrollments
,这是我当前的基本注册设置:
class Enrollment < ActiveRecord::Base
belongs_to :father
belongs_to :mother
belongs_to :child
end
class Father < ActiveRecord::Base
has_many :enrollments
has_many :children
validates :first_name, :presence => true
validates :last_name, :presence => true
end
现在我想在表格中添加 aguardian_1_id
和 a 。我该如何设置?guardian_2_id
enrollments