class ActiveModel::Validations::InclusionValidator
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
# File lib/apple_core/active_model/validations/inclusion_validator.rb, line 6 def validate_each(record, attribute, value) delimiter = options[:in] exclusions = delimiter.respond_to?(:call) ? delimiter.call(record) : delimiter valid = if value.respond_to? :all? value.all? { |v| exclusions.include? v } else exclusions.public_send(inclusion_method(exclusions), value) end return if valid record.errors.add(attribute, :inclusion, options.except(:in).merge!(value: value)) end