Permalink
Browse files

after_commit :on => :update should be called when save is

called from after_commit callback
  • Loading branch information...
1 parent 44d1804 commit 1024c688a9190461549d4943661e9862cb1a17d4 @gnufied gnufied committed May 9, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 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 @@ def test_after_commit_in_save
topic = TopicWithSaveInCallback.new()
topic.save
assert_equal true, topic.cached
+ assert_equal true, topic.record_updated
end
end

0 comments on commit 1024c68

Please sign in to comment.