I am using form_for, but I’m not sure how to create the password and password confirmation using the helpers?
I have so far:
<%= form_for :user, @user, .... do |f| %>
<%= f.text_field :user_name, :class .... %>
password??
<% end %>
Also, when posting to the /user/create action, how to do I prevent certain fields in the model from being initialized when using:
@user = User.new(params[:user])
Put this in your view form:
And this in your user model:
Now, to prevent unwanted initializations in your controller, add the following to your model:
Now these attributes will be the only attributes that can be set through what is called “mass assignment”.