Skip to content

Commit ceb6971

Browse files
author
Michael Mantos
committed
INV-1618 - Fix autoload issue of constants
1 parent 6811722 commit ceb6971

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

lib/stackify/engine.rb

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,27 @@ class Engine < ::Rails::Engine
3939
end
4040
end
4141

42-
def set_console_logs logger
43-
# Handle the stdout logs from Action Controller
44-
ActionController::Base.logger = logger
42+
def set_console_logs new_logger
43+
if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new('6.0')
44+
ActiveSupport.on_load(:action_controller_base) do
45+
logger = new_logger
46+
end
47+
ActiveSupport.on_load(:action_view) do
48+
logger = new_logger
49+
end
50+
ActiveSupport.on_load(:active_record) do
51+
logger = new_logger
52+
end
53+
else
54+
# Handle the stdout logs from Action Controller
55+
ActionController::Base.logger = logger
4556

46-
# Handle the stdout logs from Action View
47-
ActionView::Base.logger = logger
57+
# Handle the stdout logs from Action View
58+
ActionView::Base.logger = logger
4859

49-
# Handle the stdout logs from Active Record
50-
ActiveRecord::Base.logger = logger
60+
# Handle the stdout logs from Active Record
61+
ActiveRecord::Base.logger = logger
62+
end
5163
end
5264
end
5365

0 commit comments

Comments
 (0)