3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/active_record_segment/controller_context.rb', line 3
def around(controller)
if controller.present?
ActiveRecordSegment.purge_store!
ActiveRecordSegment.store[:current_user] = controller.current_user if controller.respond_to?(:current_user)
ActiveRecordSegment.store[:current_company] = controller.current_company if controller.respond_to?(:current_company)
ActiveRecordSegment.store[:request_uuid] = controller.request.uuid
ActiveRecordSegment.store[:remote_ip] = controller.request.remote_ip
ActiveRecordSegment.store[:current_controller] = controller
end
yield
ensure
ActiveRecordSegment.purge_store!
end
|