Adding configuration support and changing 'couchrest-type' key to 'model' along with config options
This commit is contained in:
parent
5c21de8586
commit
85cd1308bc
14 changed files with 157 additions and 17 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue