Hello everybody. I have two models user and user_information. the User 
has_one user_information and the UserInformation belongs_to user. Now I 
need to make a form_for to create the user information for an user. So I go 
to the following link: http://localhost:3000/users/1/user_informations/new 
a fill the form, with the user_id, and the other fields. But I get the 
following error:

Can't mass-assign protected attributes: user_id


I think the error is in the user_information#new view, in the form_form. This 
is the actual form

<%= form_for(@user_information) do |f| %>

<%= f.text_field :user %>
  </div>
  <div class="field">
    <%= f.label :address %><br />
    <%= f.text_field :address %>
  </div>
  <div class="field">
    <%= f.label :phone %><br />
    <%= f.text_field :phone %>
  </div>
  <div class="field">
    <%= f.label :business %><br />
    <%= f.check_box :business %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>


I think the form_for should be something like <%= form_for([@user_information, 
@user.user_information.bluild]) do |f| %> but it doesn't work. So I really 
really need your help, please. 

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/xCZVgj_hsXUJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to