rails/rails — pull request #7241 by alexch (2012-08-02 23:40:33+00:00)
Title: alias attr_accessible to mass_assignable

attr_accessible is a very confusing name.

First, it has nothing to do with the other attr_* macros, which deal with Ruby instance-variable-based getters and setters, not Rails attributes.

Second, the term "access" is generally understood to refer to reading a value, viz. accessor vs. mutator. Yet this macro is about the *opposite* of reading; instead, it determines whether an attribute can be *written*, aka assigned.

Third, this is in a module called Mass Assignment, and this macro is literally specifying which values can be mass assigned. So why be so mysterious? Let's just call it mass_assignable and get on with our lives. It will make this feature more understandable to every Rails programmer who has had to figure out what that line is doing there, especially now that it's in every generated model class -- and rightly so, since it's an important and useful feature and deserves to be embraced and understood by all.

This patch is just to show the (trivial) implementation; changes to documentation and to the generators will follow if people agree it's worth doing.