I am wanting to be able to click a link and update an attribute is_public
in rails4 with strong parameters. Here is my current code:
<small><%= link_to "make private", property_url(@property,is_public: !@property.is_public), method: "patch" %></small>
The issue I have with this, is in the controller the strong parameters will receive a No Method for Nil Class for the .permit
method because it doesn't create params[property][:is_public]
. It just creates params[:is_public]
and the ID of the property.
Is there a rails way of making it nest the parameters in the object or will I have to hard code (I don't even like hard coding my name) this?