lib/couchrest/model/base.rb in couchrest_model-1.0.0.beta8 vs lib/couchrest/model/base.rb in couchrest_model-1.0.0

- old
+ new

@@ -2,20 +2,20 @@ module Model class Base < Document extend ActiveModel::Naming + include CouchRest::Model::Configuration include CouchRest::Model::Persistence include CouchRest::Model::Callbacks include CouchRest::Model::DocumentQueries include CouchRest::Model::Views include CouchRest::Model::DesignDoc include CouchRest::Model::ExtendedAttachments include CouchRest::Model::ClassProxy include CouchRest::Model::Collection - include CouchRest::Model::AttributeProtection - include CouchRest::Model::Attributes + include CouchRest::Model::PropertyProtection include CouchRest::Model::Associations include CouchRest::Model::Validations def self.subclasses @subclasses ||= [] @@ -35,23 +35,23 @@ subclasses << subklass end # Accessors attr_accessor :casted_by - + # Instantiate a new CouchRest::Model::Base by preparing all properties # using the provided document hash. # # Options supported: # # * :directly_set_attributes: true when data comes directly from database # def initialize(doc = {}, options = {}) - prepare_all_attributes(doc, options) + doc = 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