Permalink
Browse files

Merge pull request #15475 from sgrif/sg-initialize-attributes

Remove unused `initialize_attributes` method
  • Loading branch information...
2 parents 9e4bb99 + 032a8d9 commit c07d09559ec171e1904b55c7ad7e8c7d586ca51b @guilleiguaran guilleiguaran committed Jun 2, 2014
@@ -252,7 +252,7 @@ def initialize(attributes = nil, options = {})
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 @@ def initialize(attributes = nil, options = {})
# 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 @@ def init_with(coder)
##
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
@@ -295,13 +295,6 @@ def reset_column_information
@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.
@@ -177,7 +177,7 @@ def pluck(*column_names)
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

0 comments on commit c07d095

Please sign in to comment.