ryanb/nested_form — Issue #113: how to update attribute on join model?
Author: jdkealy
Created: 2011-11-03 08:32:33+00:00
State: open

Hi using:
simple_nested_form_for,

how would i update an attribute on a join model?

I have:

Profile, Organization, Membership

Profile has_many :memberships
Profile has_many :organizations, :through => :memberships

The membership has a column, 'title'.

I need to be able to say Joe (profile) is a 'senior vp' (membership) at Microsoft (organization).

I have:

= simple_nested_form_for(profile)

Organization
= f.fields_for :organisations do |org|
= org.input :name, :label => "Name of the Organization"
//= org.input :title, :label => "Your role"
= org.input :description, :as => :text, :label => "Description of the organization
= org.link_to_remove "Remove this oranisation"
= f.link_to_add "Add an organisation", :organisations

How do I add an attribute here regarding the membership to the organization?