1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

called from after_commit callback
This commit is contained in:
Hemant Kumar 2012-05-09 18:37:46 +05:30
parent 44d1804b0a
commit 1024c688a9

View file

@ -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