Class: Congo::Metadata::Validation

Inherits:
Object
  • Object
show all
Includes:
MongoMapper::EmbeddedDocument
Defined in:
lib/congo/metadata/validation.rb

Instance Method Summary collapse

Instance Method Details

#apply(klass, scope) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/congo/metadata/validation.rb', line 17

def apply(klass, scope)
  options = { :message => type_to_i18n }
  case self.type
  when 'format_of'
    options.merge! :with => /#{self.argument}/
  end        
  klass.send("validates_#{type}", key, options)
end