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.

Was it helpful?

Solution

attr_protected

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top