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:
parent
44d1804b0a
commit
1024c688a9
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue