aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/dirty_test.rb
diff options
context:
space:
mode:
authorMike Breen <hardbap@gmail.com>2009-08-09 16:34:05 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-08-09 16:34:53 +0100
commit7d254b5d74144a1e217125e7be21882ce380a3f8 (patch)
tree6da12d509e70a8dc0c824d6111f27bc0404e100a /activerecord/test/cases/dirty_test.rb
parent96b575d6dcea6c9c4a716b4929c319695afa59f3 (diff)
downloadrails-7d254b5d74144a1e217125e7be21882ce380a3f8.tar.gz
rails-7d254b5d74144a1e217125e7be21882ce380a3f8.tar.bz2
rails-7d254b5d74144a1e217125e7be21882ce380a3f8.zip
Serialized attributes should only be saved with partial_updates when the serialized attribute is present [#2397 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test/cases/dirty_test.rb')
-rw-r--r--activerecord/test/cases/dirty_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb
index 1441421a80..74571d923a 100644
--- a/activerecord/test/cases/dirty_test.rb
+++ b/activerecord/test/cases/dirty_test.rb
@@ -298,6 +298,16 @@ class DirtyTest < ActiveRecord::TestCase
end
end
+ def test_save_should_not_save_serialized_attribute_with_partial_updates_if_not_present
+ with_partial_updates(Topic) do
+ Topic.create!(:author_name => 'Bill', :content => {:a => "a"})
+ topic = Topic.first(:select => 'id, author_name')
+ topic.update_attribute :author_name, 'John'
+ topic = Topic.first
+ assert_not_nil topic.content
+ end
+ end
+
private
def with_partial_updates(klass, on = true)
old = klass.partial_updates?