Reputation: 3168
I'm working on upgrading a rails 3.2.22.5
app to4.2.10
, I am using strong_params
to replace the attr_accessible
feature but there are some models which do not have a controller for them and I know I can use the protected_attributes gem to support it but I was wondering if there are any other alternatives someone has tried to completely get rid of using attr_accessible
because it is not supported on rails 5 and I don't want to go through all of this again when I go to rails 5
.
Upvotes: 0
Views: 247
Reputation: 102045
You can use the strong_parameters gem to backport the Rails 4+ strong parameters.
The whole approach of whitelisting parameters in the model has been deemed deeply flawed since models are not aware of the request context.
You should be changing to controller based whitelisting ASAP. This also makes the whole concept of "whitelisting" a model without a controller void.
Upvotes: 1