Exception: ActionPolicy::NotFound

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

Overview

Raised when Action Policy fails to find a policy class for a record.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, message = nil) ⇒ NotFound

Returns a new instance of NotFound.



19
20
21
22
23
24
25
# File 'lib/action_policy.rb', line 19

def initialize(target, message = nil)
  @target = target
  @message =
    message ||
    "Couldn't find policy class for #{target.inspect}" \
    "#{target.is_a?(Module) ? "" : " (#{target.class})"}"
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



17
18
19
# File 'lib/action_policy.rb', line 17

def message
  @message
end

#targetObject (readonly)

Returns the value of attribute target.



17
18
19
# File 'lib/action_policy.rb', line 17

def target
  @target
end