Rails 3.1 introduces the concept of mass-assignment roles which allow you to specify accessible attributes for a specific permission or role. For instance, if you wanted your users to be able to edit their names, but not their permissions you could limit their accessible attributes but allow administrators to edit permissions:
While this syntax is awesome the AR#new, AR#create and AR#update_attributes syntax is horrible:
It seems like the same primitive syntax that AR#find used in Rails 2.x:
That was replaced with elegant chaining in Rails 3.0:
Why not do the same with mass-assignment roles?
I can see the conflict this might cause with scopes, but maybe there’s an elegant balance so that we aren’t passing multiple hash parameters to AR#new, AR#create and AR#update_attributes.