class Detox::Validations::ValuesUniquenessValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/detox/validations/values_uniqueness.rb, line 9
def validate_each(record, attribute, value)
  args = { :record => record,
           :attribute => attribute,
           :value => value,
           :message => options[:message] || :values_not_unique,
           :options => options }

  validate_values(args)
end

Private Instance Methods

values_valid?(values) click to toggle source
# File lib/detox/validations/values_uniqueness.rb, line 20
def values_valid?(values)
  values.uniq.length == values.length
end