Created
March 5, 2012 02:37
-
-
Save jbarnette/1976133 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveRecord::Base | |
attr_accessible nil | |
def update_attributes *args | |
raise "Don't call #{self.class.name}#update_attributes. " + | |
"Mass assignment is pure evil." | |
end | |
end |
Can you clarify why update_attributes
is bad? The Rails Security Guide states:
In a similar way,
new
,create
,create!
,update_attributes
, andupdate_attributes!
methods all respect mass-assignment security and accept either:as
or:without_protection
options.
Given that, I fail to see why disabling update_attributes
is necessary.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
efficient !