Module: SimplyStored::Couch::Validations

Included in:
ClassMethods
Defined in:
lib/simply_stored/couch/validations.rb

Defined Under Namespace

Classes: ValidatesFormatOf, ValidatesInclusionOf, ValidatesUniquenessOf

Instance Method Summary collapse

Instance Method Details

#validates_format_of(*args) ⇒ Object



67
68
69
# File 'lib/simply_stored/couch/validations.rb', line 67

def validates_format_of(*args)
  add_validations(args, ValidatesFormatOf)
end

#validates_inclusion_of(*args) ⇒ Object



63
64
65
# File 'lib/simply_stored/couch/validations.rb', line 63

def validates_inclusion_of(*args)
  add_validations(args, ValidatesInclusionOf)
end

#validates_uniqueness_of(*args) ⇒ Object



71
72
73
74
75
76
77
78
79
# File 'lib/simply_stored/couch/validations.rb', line 71

def validates_uniqueness_of(*args)
  args.each do |name|
    if not respond_to?("by_#{name}")
      view "by_#{name}", :key => name
    end
  end
  
  add_validations(args, ValidatesUniquenessOf)
end