diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 636110841..9c518a8fa 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -43,7 +43,7 @@ jobs: fail-fast: false matrix: ruby: [ '3.0', '3.1', '3.2' ] - gemfile: [ rails.6.1.activerecord, rails.7.0.activerecord ] + gemfile: [ rails.6.1.activerecord, rails.7.0.activerecord, rails.7.1.activerecord ] name: ${{ matrix.ruby }}-${{ matrix.gemfile }} env: diff --git a/CHANGELOG.md b/CHANGELOG.md index fc63274c0..4337b3809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### New Features +* [#888](/~https://github.com/toptal/chewy/pull/907): Fix deprecation warning in LogSubscriber for Rails 7.1 ([@alejandroperea](/~https://github.com/alejandroperea)) + ### Changes ### Bugs Fixed diff --git a/gemfiles/rails.7.1.activerecord.gemfile b/gemfiles/rails.7.1.activerecord.gemfile new file mode 100644 index 000000000..af8ec812e --- /dev/null +++ b/gemfiles/rails.7.1.activerecord.gemfile @@ -0,0 +1,13 @@ +source 'https://rubygems.org' + +gem 'activejob', '~> 7.1.0' +gem 'activerecord', '~> 7.1.0' +gem 'activesupport', '~> 7.1.0' +gem 'kaminari-core', '~> 1.1.0', require: false +gem 'parallel', require: false +gem 'rspec_junit_formatter', '~> 0.4.1' +gem 'sidekiq', require: false + +gem 'rexml' if RUBY_VERSION >= '3.0.0' + +gemspec path: '../' diff --git a/lib/chewy.rb b/lib/chewy.rb index a6239be31..d94497065 100644 --- a/lib/chewy.rb +++ b/lib/chewy.rb @@ -1,6 +1,6 @@ require 'active_support/version' require 'active_support/concern' -require 'active_support/deprecation' +require 'active_support/deprecation' if ActiveSupport.version < '7.1' require 'active_support/json' require 'active_support/log_subscriber' diff --git a/lib/chewy/log_subscriber.rb b/lib/chewy/log_subscriber.rb index c35d63fbf..6227ece82 100644 --- a/lib/chewy/log_subscriber.rb +++ b/lib/chewy/log_subscriber.rb @@ -24,7 +24,11 @@ def render_action(action, event) subject = payload[:type].presence || payload[:index] action = "#{subject} #{action} (#{event.duration.round(1)}ms)" - action = color(action, GREEN, true) + action = if ActiveSupport.version >= '7.1' + color(action, GREEN, bold: true) + else + color(action, GREEN, true) + end debug(" #{action} #{description}") end