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

@ -97,7 +97,7 @@ module CouchRest
# ==== Returns
# a document instance
def create_from_database(doc = {})
base = (doc['couchrest-type'].blank? || doc['couchrest-type'] == self.to_s) ? self : doc['couchrest-type'].constantize
base = (doc[model_type_key].blank? || doc[model_type_key] == self.to_s) ? self : doc[model_type_key].constantize
base.new(doc, :directly_set_attributes => true)
end