couchrest_model/spec/fixtures/more/cat.rb
2009-10-31 10:40:56 -02:00

20 lines
479 B
Ruby

class Cat < CouchRest::ExtendedDocument
include ::CouchRest::Validation
# Set the default database to use
use_database DB
property :name, :accessible => true
property :toys, :cast_as => ['CatToy'], :default => [], :accessible => true
property :favorite_toy, :cast_as => 'CatToy', :accessible => true
property :number
end
class CatToy < Hash
include ::CouchRest::CastedModel
include ::CouchRest::Validation
property :name
validates_presence_of :name
end