Exception: ActionPolicy::UnknownRule

Inherits:
Error
  • Object
show all
Defined in:
lib/action_policy/policy/core.rb

Overview

Raised when ‘resolve_rule` failed to find an approriate policy rule method for the activity

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(policy, rule) ⇒ UnknownRule

Returns a new instance of UnknownRule.



17
18
19
20
21
# File 'lib/action_policy/policy/core.rb', line 17

def initialize(policy, rule)
  @policy = policy.class
  @rule = rule
  @message = "Couldn't find rule '#{@rule}' for #{@policy}"
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



15
16
17
# File 'lib/action_policy/policy/core.rb', line 15

def message
  @message
end

#policyObject (readonly)

Returns the value of attribute policy.



15
16
17
# File 'lib/action_policy/policy/core.rb', line 15

def policy
  @policy
end

#ruleObject (readonly)

Returns the value of attribute rule.



15
16
17
# File 'lib/action_policy/policy/core.rb', line 15

def rule
  @rule
end