How do I see which params are failing a mass_assignment error?

52 views Asked by At

I'm upgrading an app to rails 4, and I am trying to figure out why my API controller is throwing a mass assignment error. How do I find out what parameter isn't being accepted? The error doesn't give me any information on why I'm getting a mass assignment error.

[1] pry(#<Api::V1::RegistrationsController>)> User.new(params[:user])
ActiveModel::ForbiddenAttributesError: ActiveModel::ForbiddenAttributesError
from /Users/arelenglish/.rvm/gems/ruby-2.1.0/gems/activemodel-4.1.7/lib/active_model/forbidden_attributes_protection.rb:21:in `sanitize_for_mass_assignment'

I'm using devise, but in a before action am calling:

def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) do |u| 
      u.permit(:email, 
               :goal_id, 
               :experience_level_id, 
               :gender)
    end
  end

I just can't figure out what exactly is failing, and am having a hard time debugging as a result.

1

There are 1 answers

0
Stanislav Mekhonoshin On BEST ANSWER

I don't know about using pry for it. But when you have rails app running, you can make

tail -f log/development.log

and there will be written which params are not whitelisted