aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2013-04-25 02:04:07 +0900
committerkennyj <kennyj@gmail.com>2013-04-25 03:01:19 +0900
commit8c8d34fa55b471858b7466789830ff936c550a8f (patch)
treec0e00cf34d93953e0a6e600608b91ac98379ff07 /activerecord
parent5bdd76fc3b83f9cf3320905daae390ced4e7bf33 (diff)
downloadrails-8c8d34fa55b471858b7466789830ff936c550a8f.tar.gz
rails-8c8d34fa55b471858b7466789830ff936c550a8f.tar.bz2
rails-8c8d34fa55b471858b7466789830ff936c550a8f.zip
Added testcase for #10067 and a CHANGELOG entry about this change.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md7
-rw-r--r--activerecord/test/cases/serialized_attribute_test.rb14
2 files changed, 21 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index d47a23b8f5..a171ee8293 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,5 +1,12 @@
## Rails 4.0.0 (unreleased) ##
+* Fix a SystemStackError problem when using time zone aware or serialized attributes.
+ In current implementation, we re-use `column_types` argument when initiating an instance.
+ If an instance have serialized or timezone aware attributes,
+ column_types is wrapped multiple times in `decorate_columns` method. Thus the above error occurs.
+
+ *Dan Erikson & kennyj*
+
* Fix for a regression bug in which counter cache columns were not being updated
when record was pushed into a has_many association. For example:
diff --git a/activerecord/test/cases/serialized_attribute_test.rb b/activerecord/test/cases/serialized_attribute_test.rb
index 726338db14..d0e012902e 100644
--- a/activerecord/test/cases/serialized_attribute_test.rb
+++ b/activerecord/test/cases/serialized_attribute_test.rb
@@ -1,5 +1,6 @@
require 'cases/helper'
require 'models/topic'
+require 'models/reply'
require 'models/person'
require 'models/traffic_light'
require 'bcrypt'
@@ -241,4 +242,17 @@ class SerializedAttributeTest < ActiveRecord::TestCase
assert_equal [], light.state
assert_equal [], light.long_state
end
+
+ def test_serialized_columh_should_not_be_wrapped_twice
+ Topic.serialize(:content, MyObject)
+
+ myobj = MyObject.new('value1', 'value2')
+ Topic.create(content: myobj)
+ Topic.create(content: myobj)
+
+ Topic.all.each do |topic|
+ type = topic.instance_variable_get("@columns_hash")["content"]
+ assert !type.instance_variable_get("@column").is_a?(ActiveRecord::AttributeMethods::Serialization::Type)
+ end
+ end
end