有没有人有幸让 has_one 在同一模型中经历 has_many 关系。我不断得到
ActiveRecord::HasOneThroughCantAssociateThroughCollection: 不能有 has_one:through 关联
似乎很容易获取一组 has_many 结果并通过特定键对其进行过滤并将其称为 has_one 关系。
使用导轨 3.2.12
这是我现在的协会,参与是一种不同的模式。
has_one :original_participation, :through => :participation
has_one :original_participant, :through => :original_participants, :foreign_key => "organization_id"
has_many :original_participants,
:through => :original_participation,
:source => :participants
我需要通过最后一个关联并按组织 ID 过滤它。
ActiveRecord::HasOneThroughCantAssociateThroughCollection: 不能有一个 has_one :through 关联 'Surveys::Participant#original_participant' 其中 :through 关联 'Surveys::Participant#original_participants' 是一个集合。改为在 :through 选项中指定 has_one 或 belongs_to 关联。