Skip to content

Commit

Permalink
Fix with ActiveRecord.version
Browse files Browse the repository at this point in the history
  • Loading branch information
kenn committed Nov 4, 2023
1 parent 3174c25 commit b46abe0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ jobs:
matrix:
ruby:
- "2.5"
- "2.2"
rails_version:
- "7.1"
- "5.2"
- "4.2"
bundler:
- "1.17.3"
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: gemfiles/rails${{ matrix.rails_version }}.gemfile
Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ doc/
lib/bundler/man
pkg
rdoc
spec/db
spec/reports
test/tmp
test/version_tmp
tmp

test_db
test_standby_one
test_standby_two
2 changes: 1 addition & 1 deletion lib/standby/active_record/log_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def debug(msg)
end

def log_header
if "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}".to_f >= 7.1
if Gem::Version.new(ActiveRecord.version) >= Gem::Version.new('7.1')
color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, bold: true)
else
color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, true)
Expand Down
6 changes: 3 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
require 'standby'

ActiveRecord::Base.configurations = {
'test' => { 'adapter' => 'sqlite3', 'database' => 'test_db' },
'test_standby' => { 'adapter' => 'sqlite3', 'database' => 'test_standby_one' },
'test_standby_two' => { 'adapter' => 'sqlite3', 'database' => 'test_standby_two'},
'test' => { 'adapter' => 'sqlite3', 'database' => 'spec/db/test_db' },
'test_standby' => { 'adapter' => 'sqlite3', 'database' => 'spec/db/test_standby_one' },
'test_standby_two' => { 'adapter' => 'sqlite3', 'database' => 'spec/db/test_standby_two'},
'test_standby_url' => 'postgres://root:@localhost:5432/test_standby'
}

Expand Down

0 comments on commit b46abe0

Please sign in to comment.