Started working on casted models, basic functionalities are now in.

property :casted_attribute, :cast_as => 'WithCastedModelMixin'

A casted attribute now knows about its parent. (#casted_by to retrieve the parent's object)
This commit is contained in:
Matt Aimonetti 2009-02-09 11:20:23 -08:00
parent fa7b176fce
commit 621f5565e9
10 changed files with 177 additions and 40 deletions

View file

@ -126,10 +126,7 @@ module CouchRest
self.respond_to?(name, true) ? self.send(name) : nil
end
# Get the corresponding Resource property, if it exists.
#
# Note: CouchRest validations can be used on non-CouchRest resources.
# In such cases, the return value will be nil.
# Get the corresponding Object property, if it exists.
def validation_property(field_name)
properties.find{|p| p.name == field_name}
end