module Pundit
def policy(user, record)
Experimental RBS support (using type sampling data from the type_fusion
project).
def policy: (User user, User record) -> nil
This signature was generated using 1 sample from 1 application.
-
(Object, nil)
- instance of policy class with query methods
Raises:
-
(InvalidConstructorError)
- if the policy constructor called incorrectly
Parameters:
-
record
(Object
) -- the object we're retrieving the policy for -
user
(Object
) -- the user that initiated the action
Other tags:
- See: https://github.com/varvet/pundit#policies -
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