You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 17, 2017. It is now read-only.
The Rails 4 migration section of the documentation says to remove attr_accessible and attr_protected from the models being migrated. This will only work if you disable default whitelisting by setting:
config.active_record.whitelist_attributes = false
If default whitelisting is enable I found I need to disable the whitelist on a per model basis like this:
classPost < ActiveRecord::Baseattr_protected# disable whitelist for this modelincludeActiveModel::ForbiddenAttributesProtectionend
Isn't it safer to keep default whitelisting enabled and disable only after the full migration is finished?
The text was updated successfully, but these errors were encountered:
@scottjacobsen Thanks for mentioning this! I was stuck trying to figure out why the migration instructions were not working for me. I like your suggestion, which would make the steps:
Work one model at a time
First add include ActiveModel::ForbiddenAttributesProtection
And add attr_protected
Verify controller/integration tests fail
Fix by using require and permit
Move on to the next model
Then set config.active_record.whitelist_attributes = false once the migration is complete.
The Rails 4 migration section of the documentation says to remove
attr_accessible
andattr_protected
from the models being migrated. This will only work if you disable default whitelisting by setting:If default whitelisting is enable I found I need to disable the whitelist on a per model basis like this:
Isn't it safer to keep default whitelisting enabled and disable only after the full migration is finished?
The text was updated successfully, but these errors were encountered: