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.