When using wrap_parameters in Rails controllers[1], encrypted attributes are not passed through to the params hash for the controller resource.
wrap_parameters uses Model.attribute_names to determine which parameters should be allowed. This falls back to Model.column_names in ActiveRecord[2], which doesn't include the parameters defined by attr_encryptor.
I'm not sure where the best place to put this fix would be, since it appears to be AR specific.
To fix in my application, I did this in my model
attr_encryptor :delivery_password
attribute_names.push 'delivery_password'
[1] http://guides.rubyonrails.org/action_controller_overview.html#json-parameters
[2] http://apidock.com/rails/ActiveRecord/AttributeMethods/ClassMethods/attribute_names
When using
wrap_parametersin Rails controllers[1], encrypted attributes are not passed through to theparamshash for the controller resource.wrap_parametersusesModel.attribute_namesto determine which parameters should be allowed. This falls back toModel.column_namesin ActiveRecord[2], which doesn't include the parameters defined byattr_encryptor.I'm not sure where the best place to put this fix would be, since it appears to be AR specific.
To fix in my application, I did this in my model
[1] http://guides.rubyonrails.org/action_controller_overview.html#json-parameters
[2] http://apidock.com/rails/ActiveRecord/AttributeMethods/ClassMethods/attribute_names