ActiveModel::ForbiddenAttributesError in PasswordResetsController#update

ruby-on-rails

Solution

This is because of Strong parameters feature in Rails 4. It will be raised when forbidden attributes are used for mass assignment.

You have to permit the attributes in your controller. Like this

@user.update_attributes(params.require(:user).permit(:password, :password_confirmation))

Problem

I have seen Ryan railcasts episode 274 I am using rails 4 and encountered one problem. In password_resets_controller.rb ``` elsif @user.update_attributes(params[:user]) ``` IN console it showing ``` ActiveModel::ForbiddenAttributesError in PasswordResetsController#update ``` when I modified `update_attributes` to `update_attribute` it shows ``` wrong number of arguments (1 for 2) ``` `params[:user]` showing two value `password` and `password_confirmation` but i am using `password` in my login page I do not know how to solve this issue.

Original source

Related problems