From 032a8d9dc95f40581d8cbda2c297b50edaa44e6f Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Mon, 2 Jun 2014 13:51:05 -0600 Subject: Remove unused `initialize_attributes` method This was previously a hook for a special case related to `serialize`, which has since been removed. --- activerecord/lib/active_record/core.rb | 5 ++--- activerecord/lib/active_record/model_schema.rb | 7 ------- activerecord/lib/active_record/relation/calculations.rb | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 88c1fc7e4c..1d75eeda69 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -252,7 +252,7 @@ module ActiveRecord defaults = self.class.column_defaults.dup defaults.each { |k, v| defaults[k] = v.dup if v.duplicable? } - @raw_attributes = self.class.initialize_attributes(defaults) + @raw_attributes = defaults @column_types_override = nil @column_types = self.class.column_types @@ -278,7 +278,7 @@ module ActiveRecord # post.init_with('attributes' => { 'title' => 'hello world' }) # post.title # => 'hello world' def init_with(coder) - @raw_attributes = self.class.initialize_attributes(coder['attributes']) + @raw_attributes = coder['attributes'] @column_types_override = coder['column_types'] @column_types = self.class.column_types @@ -323,7 +323,6 @@ module ActiveRecord ## def initialize_dup(other) # :nodoc: cloned_attributes = other.clone_attributes(:read_attribute_before_type_cast) - self.class.initialize_attributes(cloned_attributes, :serialized => false) @raw_attributes = cloned_attributes @raw_attributes[self.class.primary_key] = nil diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index ad6428d8a8..f0ddf202c3 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -295,13 +295,6 @@ module ActiveRecord @cached_time_zone = nil end - # This is a hook for use by modules that need to do extra stuff to - # attributes when they are initialized. (e.g. attribute - # serialization) - def initialize_attributes(attributes, options = {}) #:nodoc: - attributes - end - private # Guesses the table name, but does not decorate it with prefix and suffix information. diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index d155517b18..9ee6422329 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -177,7 +177,7 @@ module ActiveRecord end result = result.map do |attributes| - values = klass.initialize_attributes(attributes).values + values = attributes.values columns.zip(values).map { |column, value| column.type_cast value } end -- cgit v1.2.3