2010-04-16 02:51:59 +02:00
|
|
|
|
|
|
|
class CatToy < Hash
|
2010-06-20 22:01:11 +02:00
|
|
|
include ::CouchRest::Model::CastedModel
|
2010-04-16 02:51:59 +02:00
|
|
|
|
|
|
|
property :name
|
|
|
|
|
|
|
|
validates_presence_of :name
|
|
|
|
end
|
|
|
|
|
2010-06-20 22:01:11 +02:00
|
|
|
class Cat < CouchRest::Model::Base
|
2009-05-12 00:17:53 +02:00
|
|
|
# Set the default database to use
|
2009-05-28 03:16:50 +02:00
|
|
|
use_database DB
|
2009-05-12 00:17:53 +02:00
|
|
|
|
2009-10-31 13:40:32 +01:00
|
|
|
property :name, :accessible => true
|
2010-05-13 00:17:30 +02:00
|
|
|
property :toys, [CatToy], :default => [], :accessible => true
|
|
|
|
property :favorite_toy, CatToy, :accessible => true
|
2009-10-31 13:40:32 +01:00
|
|
|
property :number
|
2009-05-12 00:17:53 +02:00
|
|
|
end
|
|
|
|
|
2011-06-08 18:22:35 +02:00
|
|
|
class ChildCat < Cat
|
|
|
|
property :mother, Cat
|
|
|
|
property :siblings, [Cat]
|
|
|
|
end
|