Hello guys, I come from Grails and I'm new with Ruby-on-Rails.
So, I learned that when you create a form_for with a symbol like :user("key"), when submited the params[] receive a new key with ":user" and the respective value from it:
<% form_for :user do |form| %>
<fieldset>
<legend>Password</legend>
<label for="current_password"> Current password:</label>
<%= form.password_field :current_password %>
<br>
<label for="password"> New password:</label>
<%= form.password_field :password %>
<br>
<label for="password_confirmation"> Confirm password:</label>
<%= form.password_field :password_confirmation %>
<br>
</fieldset>
<%= submit_tag "Update", :class => "submit" %>
<% end %>
params[:user => {:current_password => 123 , :password => 321 , :password_confirmation => 321}], right?
Well, the problem is that Rails don't understand the :current_password and :password_confirmation , I don't know if the problem is about the Model User don't have those attributes, only name, password and email.
Error: undefined method `password_confirmation=' for #
Is there another way to fix it without creating a attr_accessor for both symbols? I just wanna work with a simple key inside the action like:
if params[:user].password = params[:user].password_confirmation
do something...