Module: ControllerPolicies::ActionControllerPatch

Defined in:
lib/controller_policies/action_controller_patch.rb

Overview

Module containing action controller patches.

Instance Method Summary collapse

Instance Method Details

#has_enforced_policies(&block) ⇒ Object

rubocop:disable Naming/PredicateName



6
7
8
9
10
11
12
# File 'lib/controller_policies/action_controller_patch.rb', line 6

def has_enforced_policies(&block) # rubocop:disable Naming/PredicateName
  include ControllerPolicies::Enforcement

  return unless block_given?

  define_method(:ability?, &block)
end

#no_enforced_policies(arguments = {}) ⇒ Object



14
15
16
# File 'lib/controller_policies/action_controller_patch.rb', line 14

def no_enforced_policies(arguments = {})
  skip_before_action :check_abilities_by_definition, arguments
end