I''ve spent a lot of time trying to create a new model and, at the same
time, setting an attribute of the join model.
I have:
Company
has_many :managements
has_many :managers, :through => :managements
Manager
has_many :managements
has_many :companies, :through => :managements
Then I try to create a new manager with a associated company like this:
- args = @company.nil? ? [@manager] : [[@company, @manager], {:remote =>
true}]
= simple_form_for *args do |f|
= field_set_tag t(''manager.manager'') do
= f.input :name
= f.input :surname
= f.input :fiscal_code
= f.input :city
= f.input :zip_code
= f.input :address
= f.input :street_number
= f.input :tel
= f.input :email
= f.simple_fields_for :managements do |p|
= p.input :role
I don''t see the field role in the form and I don''t know how to
set
role when the Management model is created.
How to do this?
Please an advice.
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.