Adding configuration support and changing 'couchrest-type' key to 'model' along with config options

This commit is contained in:
Sam Lown 2010-09-17 23:00:55 +02:00
parent 5c21de8586
commit 85cd1308bc
14 changed files with 157 additions and 17 deletions

View file

@ -4,6 +4,7 @@ module CouchRest
extend ActiveModel::Naming
include CouchRest::Model::Configuration
include CouchRest::Model::Persistence
include CouchRest::Model::Callbacks
include CouchRest::Model::DocumentQueries
@ -37,7 +38,7 @@ module CouchRest
# Accessors
attr_accessor :casted_by
# Instantiate a new CouchRest::Model::Base by preparing all properties
# using the provided document hash.
@ -50,7 +51,7 @@ module CouchRest
prepare_all_attributes(doc, options)
super(doc)
unless self['_id'] && self['_rev']
self['couchrest-type'] = self.class.to_s
self[self.model_type_key] = self.class.to_s
end
after_initialize if respond_to?(:after_initialize)
end