What is the opposite of attr_accessible in Rails?
-
05-02-2021 - |
Question
What is the opposite of attr_accessible in Rails?
Instead of writting every single attribute I want to write just the ones I want to block.
Solution
Mass-assignment to these attributes will simply be ignored, to assign to them you can use direct writer methods. This is meant to protect sensitive attributes from being overwritten by malicious users tampering with URLs or forms.
OTHER TIPS
Its attr_protected, information can be found here...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow