私は ryan bates のプラグイン nested_form を使用しており、 has_many :through 関係のフォームを作成しようとしています。
私は3つのモデルを持っています:
Profile
has_many :memberships
has_many :organizations, :through => :memberships
accepts_attributes_for :organizations
attr_accessible :organization_attribtues
Membership
has_many :profiles
has_many :organizations
Organization
has_many :memberships
has_many :profiles, :though => :memberships
以下のフォームはプロファイル用ですが、その中に組織がネストされています。f.fields_for :organizations を実行して組織に関する情報を作成できますが、組織のメンバーシップに固有の情報を更新する方法がわかりません。具体的には、メンバーシップ テーブルに title 属性があります (Organization の未定義メソッド「title」というエラーがスローされるため、以下でコメントアウトしました)。どんな助けでも大歓迎です!ありがとう。
= f.fields_for :organisations do |org|
= org.input :name, :label => "<strong>Name of the Organization</strong>"
= org.input :title, :label => "Your role"
= org.input :description, :as => :text, :label => "Description of the organization",