This video states that it is possible to protect the input coming in via the controller yet still be able to do mass assignment via models and specs. However, I have not seen this documented as a feature when using strong_parameters in 3.2.8.
I understand that I need to mix in ActiveModel::ForbiddenAttributesProtection
into my models and set config.active_record.whitelist_attributes = false
in config/application.rb
. I have also pulled all of my attr_accessible
calls from the model.
With or without the mixin I am getting mass assignment errors.
ActiveModel::MassAssignmentSecurity::Error:
Can't mass-assign protected attributes: home_phone, cell_phone
Am I missing something?
attr_protected :home_phone, :cell_phone
they won't be able to mass assigned.attr_protected
in my model either. But I am getting that same error.