Skip to content

Commit

Permalink
Solved AS::LogSubscriber#color DEPRECATION WARNING
Browse files Browse the repository at this point in the history
  * ActiveSupport::LogSubscriber#color bolding options was changed in rails 7.1.0
  ref: rails/rails#45976
  * original commit: #8
  • Loading branch information
fumihumi committed Oct 25, 2023
1 parent b50efb8 commit 9c27af6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/octoball/log_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ def sql(event)
private

def debug(progname = nil, &block)
conn = current_shard ? color("[Shard: #{current_shard}]", ActiveSupport::LogSubscriber::GREEN, true) : ''
if ActiveRecord.gem_version >= Gem::Version.new('7.1.0')
conn = current_shard ? color("[Shard: #{current_shard}]", ActiveSupport::LogSubscriber::GREEN, bold: true) : ''
else
conn = current_shard ? color("[Shard: #{current_shard}]", ActiveSupport::LogSubscriber::GREEN, true) : ''
end
super(conn + progname.to_s, &block)
end
end
Expand Down

0 comments on commit 9c27af6

Please sign in to comment.