Migrating from Protected Attributes to Strong Parameters

In Rails3, we use attr_accessible or attr_protected(Protected Attributes) to white-list attributes of a model for mass assignment.
In Rails4, Protected Attributes was moved out as a Gem and similar feature was implemented at the controller level, which is now known as Strong Parameters.

We were migrating one of our project from Rails3 to Rails4 and decided to use Rails' Strong Parameter instead of using the Protected Attributes Gem. While migrating from Protected Attributes to Strong Parameters we found ourself in a situation where we were repeating the same code. To elaborate, in Rails3 when we used Protected Attribute, all our white-listed attributes were at one place i.e. in the model itself. But when we used Strong Parameters, all these attributes of model came into the controllers, so if we had more than one controller dealing with same model, we were repeating the code for white-listing attributes in each controller.Read more