diff options
author | Hemant Kumar <gethemant@gmail.com> | 2012-05-09 18:37:46 +0530 |
---|---|---|
committer | Hemant Kumar <gethemant@gmail.com> | 2012-05-09 18:39:59 +0530 |
commit | 1024c688a9190461549d4943661e9862cb1a17d4 (patch) | |
tree | 808f2d96a6738c7bdc3bda98d6173df546501e23 | |
parent | 44d1804b0a86de02865c48c552bbc57da3dc7836 (diff) | |
download | rails-1024c688a9190461549d4943661e9862cb1a17d4.tar.gz rails-1024c688a9190461549d4943661e9862cb1a17d4.tar.bz2 rails-1024c688a9190461549d4943661e9862cb1a17d4.zip |
after_commit :on => :update should be called when save is
called from after_commit callback
-rw-r--r-- | activerecord/test/cases/transaction_callbacks_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
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 |