I have a nested multimodel form right now, using Users and Profiles.
Users has_one profile, and Profile belongs_to Users.
When the form is submitted, a new u
To answer question number one, change the following:
@profile = Profile.new(params[:profile])
to
@profile = @user.profile.build(params[:profile]) #In the case of a has_many relationship
or
@profile = @user.build_profile(params[:profile]) #In the case of a has_one relationship
The build command builds a new profile with the user_id properly set.
For the second question, can you delete the query for Role and Company during the new action and instead assign those during the create action? This would remove the necessity of passing hidden parameters.