-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Rails 7.1, drop Ruby 2.x and Rails < 6.1
- Loading branch information
1 parent
7d626d1
commit ab48304
Showing
21 changed files
with
73 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.7.5 | ||
3.1.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "http://rubygems.org" | ||
|
||
gem "rails", "~> 7.1.0" | ||
|
||
platforms :ruby do | ||
gem "sqlite3", "~> 1.6" | ||
end | ||
|
||
platforms :jruby do | ||
gem "activerecord-jdbc-adapter", "~> 61.0" | ||
gem "activerecord-jdbcpostgresql-adapter", "~> 61.0" | ||
gem "activerecord-jdbcmysql-adapter", "~> 61.0" | ||
end | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module ActiveRecord # :nodoc: | ||
if ActiveRecord::VERSION::MAJOR >= 6 | ||
# This is monkeypatching Active Record to ensure that whenever a new connection is established it | ||
# switches to the same tenant as before the connection switching. This problem is more evident when | ||
# using read replica in Rails 6 | ||
module ConnectionHandling | ||
def connected_to_with_tenant(role: nil, prevent_writes: false, &blk) | ||
current_tenant = Apartment::Tenant.current | ||
# This is monkeypatching Active Record to ensure that whenever a new connection is established it | ||
# switches to the same tenant as before the connection switching. This problem is more evident when | ||
# using read replica in Rails 6 | ||
module ConnectionHandling | ||
def connected_to_with_tenant(role: nil, prevent_writes: false, &blk) | ||
current_tenant = Apartment::Tenant.current | ||
|
||
connected_to_without_tenant(role: role, prevent_writes: prevent_writes) do | ||
Apartment::Tenant.switch!(current_tenant) | ||
yield(blk) | ||
end | ||
connected_to_without_tenant(role: role, prevent_writes: prevent_writes) do | ||
Apartment::Tenant.switch!(current_tenant) | ||
yield(blk) | ||
end | ||
|
||
alias connected_to_without_tenant connected_to | ||
alias connected_to connected_to_with_tenant | ||
end | ||
|
||
alias connected_to_without_tenant connected_to | ||
alias connected_to connected_to_with_tenant | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.