Class: Congo::Metadata::Key
- Inherits:
-
Object
- Object
- Congo::Metadata::Key
- Includes:
- MongoMapper::EmbeddedDocument
- Defined in:
- lib/congo/metadata/key.rb
Instance Method Summary collapse
- #apply(klass, scope) ⇒ Object
-
#name ⇒ Object
validations.
Instance Method Details
#apply(klass, scope) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/congo/metadata/key.rb', line 18 def apply(klass, scope) if type == 'File' klass.send(:include, Congo::Grip::HasAttachment) unless klass.include?(Congo::Grip::HasAttachment) # do not add the module twice klass. name.to_sym, :path => ":name/:id" else ctype = scope.content_type_as_const(type) klass.key name.to_sym, ctype klass.include_errors_from name.to_sym if ctype.instance_methods.include?('valid?') ctype.apply(klass, scope, name) if ctype.respond_to?('apply') end end |
#name ⇒ Object
validations
7 |
# File 'lib/congo/metadata/key.rb', line 7 key :name, String |