1
0
Fork 0
mirror of https://github.com/varvet/pundit.git synced 2022-11-09 12:30:11 -05:00

Quote the class name

This commit is contained in:
Jiazhen Xie 2017-02-18 16:35:34 +00:00 committed by Joe Xie
parent bae8278202
commit dddd6ff61a

View file

@ -84,7 +84,7 @@ module Pundit
policy_scope = PolicyFinder.new(scope).scope policy_scope = PolicyFinder.new(scope).scope
policy_scope.new(user, scope).resolve if policy_scope policy_scope.new(user, scope).resolve if policy_scope
rescue ArgumentError rescue ArgumentError
raise InvalidConstructorError, "Invalid #{policy_scope.class} constructor is called." raise InvalidConstructorError, "Invalid #<#{policy_scope}> constructor is called"
end end
# Retrieves the policy scope for the given record. # Retrieves the policy scope for the given record.
@ -99,7 +99,7 @@ module Pundit
policy_scope = PolicyFinder.new(scope).scope! policy_scope = PolicyFinder.new(scope).scope!
policy_scope.new(user, scope).resolve policy_scope.new(user, scope).resolve
rescue ArgumentError rescue ArgumentError
raise InvalidConstructorError, "Invalid #{policy_scope.class} constructor is called." raise InvalidConstructorError, "Invalid #<#{policy_scope}> constructor is called"
end end
# Retrieves the policy for the given record. # Retrieves the policy for the given record.
@ -113,7 +113,7 @@ module Pundit
policy = PolicyFinder.new(record).policy policy = PolicyFinder.new(record).policy
policy.new(user, record) if policy policy.new(user, record) if policy
rescue ArgumentError rescue ArgumentError
raise InvalidConstructorError, "Invalid #{policy.class} constructor is called." raise InvalidConstructorError, "Invalid #<#{policy}> constructor is called"
end end
# Retrieves the policy for the given record. # Retrieves the policy for the given record.
@ -128,7 +128,7 @@ module Pundit
policy = PolicyFinder.new(record).policy! policy = PolicyFinder.new(record).policy!
policy.new(user, record) policy.new(user, record)
rescue ArgumentError rescue ArgumentError
raise InvalidConstructorError, "Invalid #{policy.class} constructor is called." raise InvalidConstructorError, "Invalid #<#{policy}> constructor is called"
end end
end end