mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 09:11:17 +08:00
Some Rails4 updates
This commit is contained in:
@ -33,12 +33,22 @@ else
|
||||
# Outside of test mode, use after_commit
|
||||
class DiscourseObserver < ActiveRecord::Observer
|
||||
def after_commit(model)
|
||||
if model.send(:transaction_include_action?, :create)
|
||||
after_create_delegator(model)
|
||||
end
|
||||
if rails4?
|
||||
if model.send(:transaction_include_any_action?, [:create])
|
||||
after_create_delegator(model)
|
||||
end
|
||||
|
||||
if model.send(:transaction_include_action?, :destroy)
|
||||
after_destroy_delegator(model)
|
||||
if model.send(:transaction_include_any_action?, [:destroy])
|
||||
after_destroy_delegator(model)
|
||||
end
|
||||
else
|
||||
if model.send(:transaction_include_action?, :create)
|
||||
after_create_delegator(model)
|
||||
end
|
||||
|
||||
if model.send(:transaction_include_action?, :destroy)
|
||||
after_destroy_delegator(model)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user