Module: Armada::ClassMethods
- Defined in:
- lib/armada/validations.rb
Instance Method Summary collapse
-
#validates_uniqueness_of(*attr_names) ⇒ Object
Configuration options: *
:message
- Specifies a custom error message (default is: “has already been taken”).
Instance Method Details
#validates_uniqueness_of(*attr_names) ⇒ Object
Configuration options:
-
:message
- Specifies a custom error message (default is: “has already been taken”). -
:scope
- One or more columns by which to limit the scope of the uniqueness constraint. -
:allow_nil
- If set to true, skips this validation if the attribute isnil
(default isfalse
). -
:allow_blank
- If set to true, skips this validation if the attribute is blank (default isfalse
). -
:if
- Specifies a method, proc or string to call to determine if the validation should
occur (e.g. :if => :allow_validation
, or :if => Proc.new { |user| user.signup_step > 2 }
). The method, proc or string should return or evaluate to a true or false value.
-
:unless
- Specifies a method, proc or string to call to determine if the validation should
not occur (e.g. :unless => :skip_validation
, or :unless => Proc.new { |user| user.signup_step <= 2 }
). The method, proc or string should return or evaluate to a true or false value.
37 38 39 |
# File 'lib/armada/validations.rb', line 37 def validates_uniqueness_of(*attr_names) validates_with UniquenessValidator, _merge_attributes(attr_names) end |