2017-03-09 11:44:51 +00:00
|
|
|
module ApplicationController::HandlesTransitions
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
2021-01-12 14:03:51 +00:00
|
|
|
around_action :handle_transaction
|
2017-03-09 11:44:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2021-01-12 14:03:51 +00:00
|
|
|
def handle_transaction
|
2017-03-09 11:44:51 +00:00
|
|
|
ApplicationHandleInfo.current = 'application_server'
|
|
|
|
PushMessages.init
|
|
|
|
|
2021-01-12 14:03:51 +00:00
|
|
|
yield
|
|
|
|
|
2017-03-09 11:44:51 +00:00
|
|
|
Observer::Transaction.commit
|
|
|
|
PushMessages.finish
|
|
|
|
ActiveSupport::Dependencies::Reference.clear!
|
2021-01-12 14:03:51 +00:00
|
|
|
ensure
|
|
|
|
ApplicationHandleInfo.current = nil
|
2017-03-09 11:44:51 +00:00
|
|
|
end
|
|
|
|
end
|