Is there a way to declare attr_accessible for multiple roles without a ton of duplication?
If I have several user roles, and each role is allowed to edit a different subset of attributes, here’s what my attr_accessible declaration looks like:
attr_accessible :first_name, :last_name, :active, :as => :admin
attr_accessible :first_name, :last_name, :as => :manager
attr_accessible :first_name, :last_name, :as => :guest
I’d like to either
- A) define an array of accessible attributes that can be shared among
different roles or - B) define an array of roles than can access the same
attributes
Is this possible?
All ruby code is still just ruby code… and is thus infinitely hackable. eg