I have tried every way possible and can't seem to limit the scope_to method in active_admin using cancan.
I can get the menu to play nice as well as most other methods but not scope_to
For example this works fine:
menu :if => proc{ can?(:manage, Booking) }
But not
scope_to :current_user, :association_method => :space_bookings unless proc{ can?(:manage, Booking) }
or
scope_to :current_user, :association_method => :space_bookings unless proc{ current_user.admin? }
or
scope_to :current_user, :association_method => :space_bookings unless controller.current_ability.can?( :manage, config.resource )
If I try using the current_user method without proc I get an error undefined. The current_user method is defined by devise and also in the active_admin.rb
# == Current User
#
# Active Admin will associate actions with the current
# user performing them.
#
# This setting changes the method which Active Admin calls
# to return the currently logged in user.
config.current_user_method = :current_user
Any ideas how I can gain access to the current_user method? It works everywhere else I've needed it.