I have this in : ability.rb
def initialize(user)
if user.admin?
can :manage, :all
else
can :manage, AdminUser, :id => user.id
end
end
and in application_controller.rb:
def access_denied(exception)
redirect_to admin_dashboard_path , :alert => exception.message
end
Also I have added the adapter for active admin in intializer/active_admin.rb:
config.authentication_method = :authenticate_admin_user!
config.authorization_adapter = ActiveAdmin::CanCanAdapter
config.on_unauthorized_access = :access_denied
When I go this url which he is not authorized to (e.g: http://admin.localhost.com:3000/admin/admin_users/1). Its giving error as:
ActiveRecord::RecordNotFound in Admin::AdminUsersController#show
Can anyone point me in the right direction as what I am missing here.
Thanks in advance.
I have resolved this issue by upgrading active_admin gem to gem 'activeadmin','0.6.3'.