Last active
March 12, 2020 06:51
-
-
Save alexkojin/99dc4d7112a69dfa8f34c1f8a728f7d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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