ruby - Rails Model: How to make a attribute protected or private that is not visible outside model? -
Are there some fields in the table that I do not want to appear outside?
like made_one, is_first etc. I want to determine the value of these areas with the callback in the model, but nobody is accessible to setting it up.
The standard way to prevent public assignment on certain areas is Even if you have a form with these fields, their values will not be ignored, when used in a new / call. attr_protected and In your case, you need to add this line to your model:
attr_protected:
Comments
Post a Comment