Skip to content

Commit

Permalink
Merge pull request #15695 from sgrif/sg-rm-column-types-override
Browse files Browse the repository at this point in the history
Remove unused column types override
  • Loading branch information
rafaelfranca committed Jun 13, 2014
2 parents 1e45fbc + ea6f28c commit 1dcb8e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
3 changes: 0 additions & 3 deletions activerecord/lib/active_record/core.rb
Expand Up @@ -256,7 +256,6 @@ def initialize(attributes = nil, options = {})
end

@attributes = defaults
@column_types_override = nil
@column_types = self.class.column_types

init_internals
Expand All @@ -283,7 +282,6 @@ def initialize(attributes = nil, options = {})
# post.title # => 'hello world'
def init_with(coder)
@attributes = coder['attributes']
@column_types_override = coder['column_types']
@column_types = self.class.column_types

init_internals
Expand Down Expand Up @@ -357,7 +355,6 @@ def encode_with(coder)
# FIXME: Remove this when we better serialize attributes
coder['raw_attributes'] = attributes_before_type_cast
coder['attributes'] = @attributes
coder['column_types'] = @column_types_override
coder['new_record'] = new_record?
end

Expand Down
10 changes: 2 additions & 8 deletions activerecord/lib/active_record/persistence.rb
Expand Up @@ -53,12 +53,7 @@ def instantiate(attributes, column_types = {})
type = column_types.fetch(name) { klass.type_for_attribute(name) }
h[name] = Attribute.from_database(value, type)
end

klass.allocate.init_with(
'attributes' => attributes,
'column_types' => column_types,
'new_record' => false,
)
klass.allocate.init_with('attributes' => attributes, 'new_record' => false)
end

private
Expand Down Expand Up @@ -406,8 +401,7 @@ def reload(options = nil)

@attributes.update(fresh_object.instance_variable_get('@attributes'))

@column_types = self.class.column_types
@column_types_override = fresh_object.instance_variable_get('@column_types_override')
@column_types = self.class.column_types
self
end

Expand Down

0 comments on commit 1dcb8e9

Please sign in to comment.