Ruby on rails 具有自指关联的体面_暴露

Ruby on rails 具有自指关联的体面_暴露,ruby-on-rails,simple-form,self-reference,Ruby On Rails,Simple Form,Self Reference,我有一个自我参照的联想: has_many :households has_many :relations, :through => :households has_many :inverse_relationships, :class_name => 'Household', :foreign_key => 'friend_id' has_many :inverse_relations, :through => :inverse_relationships, :sour

我有一个自我参照的联想:

has_many :households
has_many :relations, :through => :households
has_many :inverse_relationships, :class_name => 'Household', :foreign_key => 'friend_id'
has_many :inverse_relations, :through => :inverse_relationships, :source => :person
Im我的控制器与我使用的体面_曝光:

expose(:neighbor)
expose(:neighbors)
现在,在haml的简单表格中,我有:

= f.input  :first_name,:label => 'First Name'
= f.input  :middle_name, :label => 'Middle Name'
= f.input  :last_name, :label => 'Last Name'

现在,我想能够列出或输入我的“家庭”中的关系,我没有任何线索

我将其更改为一种更简单的安排,即只拥有一个包含多个邻居的家庭模型和一个邻居模型,而不是通过家庭将邻居链接到邻居的自参考安排

有时候越简单越好