Skip to content

Cancan and collection resource action items (buttons)

houen edited this page Jan 26, 2012 · 1 revision

In order to get CanCan to work with actions that work on the collection of items in a resource (e.g. new, import, export) you need to check for CanCan abilities like so: (from #72)


ActiveAdmin.register Post do
  action_item :only => [:edit, :show] do
    if controller.current_ability.can?( :change_password, resource ) 
      link_to "Change Password", change_password_app_admin_user_path( resource )
    end
  end
end