lib/audited/sweeper.rb in audited-4.10.0 vs lib/audited/sweeper.rb in audited-5.0.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Audited
class Sweeper
STORED_DATA = {
current_remote_address: :remote_ip,
current_request_uuid: :request_uuid,
@@ -8,11 +10,11 @@
delegate :store, to: ::Audited
def around(controller)
self.controller = controller
- STORED_DATA.each { |k,m| store[k] = send(m) }
+ STORED_DATA.each { |k, m| store[k] = send(m) }
yield
ensure
self.controller = nil
STORED_DATA.keys.each { |k| store.delete(k) }
end
@@ -34,16 +36,7 @@
end
def controller=(value)
store[:current_controller] = value
end
- end
-end
-
-ActiveSupport.on_load(:action_controller) do
- if defined?(ActionController::Base)
- ActionController::Base.around_action Audited::Sweeper.new
- end
- if defined?(ActionController::API)
- ActionController::API.around_action Audited::Sweeper.new
end
end