Search code examples
ruby-on-railsruby-on-rails-5rubymine

Rubymine error log message: Unpermitted parameters


on my rails log, I used to get "Unpermitted parameter: :first_name" I was able to research the answer to my problem and got it fixed. However, I would like to understand this error a bit more. So what does this error actually mean? can someone elaborate a bit more as of why this happens?


Solution

  • It seems like you have rails 4 or upgraded version or you have strong_parameters gem.

    With strong_parameters plugin Action Controller parameters are forbidden to be used in Active Model mass assignments until they have been whitelisted. This means you'll have to make a conscious choice about which attributes to allow for mass updating and thus prevent accidentally exposing that which shouldn't be exposed.

    For example if you have any login page and have 2 fields username and password and any other user tries to send any other parameter (email) than that email is not white listed and you will have same Unpermitted parameter: :email. We define which attributes a user can interact with. Hope this will help.