lib/rails_admin/extensions/pundit_nested/authorization_adapter.rb
# This is called when needing to scope a database query. It is called within the list
# and bulk_delete/destroy actions and should return a scope which limits the records
# to those which the user can perform the given action on.
This is called when needing to scope a database query. It is called within the list
and bulk_delete/destroy actions and should return a scope which limits the records
to those which the user can perform the given action on.
This is called when needing to scope a database query . It is called within the list and bulk_delete / destroy actions and should return a scope which limits the records to those which the user can perform the given action on .
def query(_action, abstract_model)
          begin
            p_scope = begin
              if parent_object.present? && association_name.present?
                @controller.policy_scope!(@controller.send(:pundit_user), parent_object.send(association_name))
              else
                @controller.policy_scope!(@controller.send(:pundit_user), abstract_model.model.all)
              end
            end
          rescue ::Pundit::NotDefinedError
            p_scope = begin
              if parent_object.present? && association_name.present?
                parent_object.send(association_name)
              else
                abstract_model.model.all
              end
            end
          end
          p_scope
        end
def query ( _action , abstract_model ) begin p_scope = begin if parent_object . present? && association_name . present? @controller . policy_scope! ( @controller . send ( :pundit_user ) , parent_object . send ( association_name ) ) else @controller . policy_scope! ( @controller . send ( :pundit_user ) , abstract_model . model . all ) end end rescue :: Pundit :: NotDefinedError p_scope = begin if parent_object . present? && association_name . present? parent_object . send ( association_name ) else abstract_model . model . all end end end p_scope end
This is called when needing to scope a database query.
This is called when needing to scope a database query .
_action
<not_specific>
abstract_model
<not_specific>