deprecated_mass_assignment_security.rb:17:in `attr_accessible': `attr_accessible` is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add `protected_attributes` to your Gemfile to use old one. (RuntimeError)
I tried what the message says, adding gem 'strong_parameters'
to my Gemfile
.
But when I do rails s
I get the error above.
I tried:
config.active_record.whitelist_attributes = true
in confgi/application.rb
, also with false
, but actually I don't understand that option.
attr_accessible
and attr_protected
have been pulled out of Rails 4 and extracted into protected_attributes. Bundle that into your app and then you should be able to use them again.
That being said, it's recommended that you use strong_parameters instead of attr_accessible
these days, so eventually you'll want to migrate to that.
In your Gemfile you will notice that gem 'protected_attributes'
has been hashed out.
Remove the hash.
Run bundle install
.
But since protected_attributes has been deprecated and may disappear in the future use strong_parameters as mentioned in the above post.
For more info on strong_parameters refer this link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With