Search code examples
ruby-on-railsactiveadminmass-assignment

ActiveAdmin role for mass assignment


In my models I have defined different roles for mass assignment. Some fields are attr_accessible :as => :default. Other fields are attr_accessible :as => [:default, :admin].

How can I allow ActiveAdmin to be able to update attributes as an admin role?


Solution

  • You can use the with_role options for ActiveAdmin controllers. For example:

    # app/admin/users.rb
    ActiveAdmin.register User do
      controller { with_role :admin }
    end