Welcome to the Treehouse Community
Looking to learn something new?
attr_accessible -> strong_parameters in Rails4 in Treebook - Gonna have an aneurism
So I have Rails4 and would like to have my parameters protected just like they are using the old attr_accessible method.
I've looked on the forums and implemented the changes in the controller, but the problem is, if I didn't do anything at all to start with, it accepts the first_name last_name automatically.
How do I setup strong_parameters so that everything isn't automatically whitelisted?
I would like to see the error message, make the change in the code, and then see a successful result.
Pleaaaaaaase help, I'm going mad here!
Jason SeiferTreehouse Guest Teacher
Hey Thomas MacFarlane we use rails 3.2.12 in the project for treebook. We're working on updated content right now but I recommend reading the strong_parameters section of the action controller guide in the mean time. In order to add an attribute to the list of available attributes, open up your controller and see where the attributes are defined. You can then add it to the permitted or denied list.
Yessssss...thanks so much for asking this question!