Method: Pundit.policy!
- Defined in:
- lib/pundit.rb
.policy!(user, record) ⇒ Object
Retrieves the policy for the given record.
152 153 154 155 156 157 |
# File 'lib/pundit.rb', line 152 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 |