Class: ResourcePolicy::ActionValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/resource_policy/validators/action_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, default_attribute, policy) ⇒ Object



20
21
22
23
24
# File 'lib/resource_policy/validators/action_validator.rb', line 20

def validate_each(record, default_attribute, policy)
  attribute = options.fetch(:as, default_attribute)
  action_policy = policy.action(action_name)
  validate_action_policy(action_policy, record:, attribute:)
end