Skip to content

Instantly share code, notes, and snippets.

@alexkojin
Last active March 12, 2020 06:51
Show Gist options
  • Save alexkojin/99dc4d7112a69dfa8f34c1f8a728f7d7 to your computer and use it in GitHub Desktop.
Save alexkojin/99dc4d7112a69dfa8f34c1f8a728f7d7 to your computer and use it in GitHub Desktop.
#test
class ActiveStorageLoggerMute
class << self
def around(controller)
if controller.kind_of?(ActiveStorage::DiskController)
begin
old_logger = ActionController::Base.logger
ActionController::Base.logger = nil
Rails.logger.silence { yield }
ensure
ActionController::Base.logger = old_logger
end
else
yield
end
end
end
end
ActiveSupport.on_load(:action_controller_base) { around_action ActiveStorageLoggerMute }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment