私は可能な限りあらゆる方法を試しましたが、cancanを使用してactive_adminのscope_toメソッドを制限できないようです。
メニューを他のほとんどのメソッドと同様にうまく再生できますが、scope_toはできません
たとえば、これは正常に機能します。
menu :if => proc{ can?(:manage, Booking) }
だがしかし
scope_to :current_user, :association_method => :space_bookings unless proc{ can?(:manage, Booking) }
また
scope_to :current_user, :association_method => :space_bookings unless proc{ current_user.admin? }
また
scope_to :current_user, :association_method => :space_bookings unless controller.current_ability.can?( :manage, config.resource )
procなしでcurrent_userメソッドを使用しようとすると、undefinedエラーが発生します。current_userメソッドは、deviseおよび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
current_userメソッドにアクセスする方法はありますか?それは私がそれを必要としていた他のどこでも機能します。