From 1024c688a9190461549d4943661e9862cb1a17d4 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Wed, 9 May 2012 18:37:46 +0530 Subject: after_commit :on => :update should be called when save is called from after_commit callback --- activerecord/test/cases/transaction_callbacks_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/transaction_callbacks_test.rb b/activerecord/test/cases/transaction_callbacks_test.rb index 9246157a13..6e6a9afeff 100644 --- a/activerecord/test/cases/transaction_callbacks_test.rb +++ b/activerecord/test/cases/transaction_callbacks_test.rb @@ -297,7 +297,13 @@ class SaveFromAfterCommitBlockTest < ActiveRecord::TestCase class TopicWithSaveInCallback < ActiveRecord::Base self.table_name = :topics after_commit :cache_topic, :on => :create + after_commit :call_update, :on => :update attr_accessor :cached + attr_accessor :record_updated + + def call_update + self.record_updated = true + end def cache_topic unless cached @@ -313,5 +319,6 @@ class SaveFromAfterCommitBlockTest < ActiveRecord::TestCase topic = TopicWithSaveInCallback.new() topic.save assert_equal true, topic.cached + assert_equal true, topic.record_updated end end -- cgit v1.2.3