module Recurso class ResourcePolicy < BasePolicy def method_missing(method) action = method.to_s.sub('?', '').to_sym super unless Recurso::Config.instance.levels_for_action.keys.include?(action) Recurso::Queries::Single.new(identity, resource, action).permission? end def resources_with_permission(relation_name, action: :view, all_columns: true, include_actions: [:modify, :administer]) Recurso::Queries::Relation.new( identity, resource, relation_name, all_columns: all_columns, action: action, include_actions: include_actions, ).resources end end end