lib/cassandra_object/base.rb in gotime-cassandra_object-2.6.4 vs lib/cassandra_object/base.rb in gotime-cassandra_object-2.7.0
- old
+ new
@@ -50,11 +50,17 @@
def initialize(attributes={})
@key = attributes.delete(:key)
@new_record = true
@destroyed = false
- @attributes = {}.with_indifferent_access
+ @attributes = {}
self.attributes = attributes
+ model_attributes.each do |k, model_attribute|
+ unless read_attribute(k)
+ write_attribute(k, model_attribute.instantiate(self, nil))
+ end
+ end
+
@schema_version = self.class.current_schema_version
end
def to_param
id.to_s if persisted?