lib/couchrest/model/persistence.rb
def build_from_database(doc = {}, options = {}, &block)
          src = doc[model_type_key]
          base = (src.blank? || src == self.to_s) ? self : src.constantize
          base.new(doc, options.merge(:directly_set_attributes => true), &block)
        end
# Creates a new instance, bypassing attribute protection and
# uses the type field to determine which model to use to instanatiate
# the new object.
#
# ==== Returns
#  a document instance
#
Creates a new instance, bypassing attribute protection and
uses the type field to determine which model to use to instanatiate
the new object.

Returns
a document instance
Creates a new instance bypassing attribute protection and uses the type field to determine which model to use to instanatiate the new object . Returns a document instance
def build_from_database(doc = {}, options = {}, &block)
          src = doc[model_type_key]
          base = (src.blank? || src == self.to_s) ? self : src.constantize
          base.new(doc, options.merge(:directly_set_attributes => true), &block)
        end
def build_from_database ( doc = { } , options = { } , & block ) src = doc [ model_type_key ] base = ( src . blank? || src == self . to_s ) ? self : src . constantize base . new ( doc , options . merge ( :directly_set_attributes => true ) , & block ) end
Creates a new instance, bypassing attribute protection and
uses the type field to determine which model to use to instanatiate
the new object.
Creates a new instance bypassing attribute protection and uses the type field to determine which model to use to instanatiate the new object .
doc
options
block