class ActiveModel::Validations::HashValuesValidator

Public Class Methods

new(options) click to toggle source
# File lib/can_has_validations/validators/hash_values_validator.rb, line 24
def initialize(options)
  record_class = options[:class]
  super
  record_class.include HashValidatorKey
end

Public Instance Methods

validate_each(record, attribute, hash) click to toggle source
# File lib/can_has_validations/validators/hash_values_validator.rb, line 30
def validate_each(record, attribute, hash)
  super(record, attribute, Array(Hash(hash)))
end
validate_one(validator, record, attribute, key_and_value) click to toggle source
# File lib/can_has_validations/validators/hash_values_validator.rb, line 34
def validate_one(validator, record, attribute, key_and_value)
  key, value = key_and_value
  record.hash_validator_key = key
  super(validator, record, attribute, value)
ensure
  record.hash_validator_key = nil
end