From 19247f9087d948fce8a5f6c04e5758be5ba66c65 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Thu, 7 Dec 2017 23:12:34 +0530 Subject: [PATCH] FIX: current_user should be called only if controller have that method --- config/initializers/100-lograge.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/100-lograge.rb b/config/initializers/100-lograge.rb index 1cb98270c3d..8676e2362ed 100644 --- a/config/initializers/100-lograge.rb +++ b/config/initializers/100-lograge.rb @@ -11,7 +11,7 @@ if (Rails.env.production? && SiteSetting.logging_provider == 'lograge') || ENV[" config.lograge.custom_payload do |controller| { ip: controller.request.remote_ip, - username: controller.current_user&.username, + username: controller.try(:current_user)&.username, } end