Class: ResourcePolicy::AttributesValidator

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

Instance Method Summary collapse

Instance Method Details

#validate_each(record, _attribute, policy) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/resource_policy/validators/attributes_validator.rb', line 27

def validate_each(record, _attribute, policy)
  hash_value = hash_value_for(record)

  hash_value.each_key do |hash_attribute|
    validate_attribute_policy(
      policy.attribute(hash_attribute),
      record: record,
      hash_attribute: hash_attribute
    )
  end
end