Method: Pundit.policy!

Defined in:
lib/pundit.rb

.policy!(user, record) ⇒ Object

Retrieves the policy for the given record.

Raises:

See Also:


140
141
142
143
144
145
# File 'lib/pundit.rb', line 140

def policy!(user, record)
  policy = PolicyFinder.new(record).policy!
  policy.new(user, pundit_model(record))
rescue ArgumentError
  raise InvalidConstructorError, "Invalid #<#{policy}> constructor is called"
end