Module: DataMapper::Validate::ValidatesIsUnique

Included in:
ClassMethods
Defined in:
lib/dm-validations/uniqueness_validator.rb

Overview

class UniquenessValidator

Instance Method Summary collapse

Instance Method Details

#validates_is_unique(*fields) ⇒ Object

Validate the uniqueness of a field


57
58
59
60
# File 'lib/dm-validations/uniqueness_validator.rb', line 57

def validates_is_unique(*fields)
  opts = opts_from_validator_args(fields)
  add_validator_to_context(opts, fields, DataMapper::Validate::UniquenessValidator)
end