2010-04-16 02:51:59 +02:00
|
|
|
|
|
|
|
class CatToy < Hash
|
|
|
|
include ::CouchRest::CastedModel
|
|
|
|
include ::CouchRest::Validation
|
|
|
|
|
|
|
|
property :name
|
|
|
|
|
|
|
|
validates_presence_of :name
|
|
|
|
end
|
|
|
|
|
2009-05-11 17:17:53 -05:00
|
|
|
class Cat < CouchRest::ExtendedDocument
|
|
|
|
include ::CouchRest::Validation
|
|
|
|
|
|
|
|
# Set the default database to use
|
2009-05-27 18:16:50 -07:00
|
|
|
use_database DB
|
2009-05-11 17:17:53 -05:00
|
|
|
|
2009-10-31 10:40:32 -02:00
|
|
|
property :name, :accessible => true
|
2010-05-10 21:19:24 +02:00
|
|
|
property :toys, :cast_as => [CatToy], :default => [], :accessible => true
|
|
|
|
property :favorite_toy, :cast_as => CatToy, :accessible => true
|
2009-10-31 10:40:32 -02:00
|
|
|
property :number
|
2009-05-11 17:17:53 -05:00
|
|
|
end
|
|
|
|
|