Skip to content

Commit 4213edf

Browse files
committed
Make it compatible with rails 7.2.x
1 parent 7c63b9e commit 4213edf

7 files changed

Lines changed: 12 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ straightforward as possible.
2121
### Fixed
2222

2323
### Security
24-
24+
25+
## [1.2.0] - 2025-08-28
26+
27+
Rails 7.2 support
28+
2529
## [1.1.0] - 2020-06-14
2630

2731
Executes any SQL statement with comments.

lib/pgpool_no_load_balance.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module PgpoolNoLoadBalance
1212
class PostgreSQLAdapterMissing < StandardError; end
1313

1414
def self.setup!
15-
unless ::ActiveRecord::Base.respond_to?(:postgresql_connection)
15+
unless defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
1616
raise PostgreSQLAdapterMissing, "No postgresql adapter specified by 'config/database.yml', or 'ActiveRecord::Base.establish_connection' method is not called."
1717
end
1818
::ActiveRecord::Base.extend PgpoolNoLoadBalance::ActiveRecord::Querying

lib/pgpool_no_load_balance/active_record/connection_adapters/postgresql_adapter.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ def execute(sql, name = nil, pgpool_nlb: false)
99

1010
private
1111

12-
def to_sql_and_binds(arel_or_sql_string, binds = [], preparable = nil) # :nodoc:
13-
sql, binds, preparable = super
12+
def to_sql_and_binds(arel_or_sql_string, binds = [], preparable = nil, allow_retry = false) # :nodoc:
13+
sql, binds, preparable, allow_retry = super
1414
if arel_or_sql_string.respond_to?(:pgpool_nlb?) && arel_or_sql_string.pgpool_nlb?
1515
sql = "#{NLB_COMMENT} #{sql}"
1616
end
17-
[sql.freeze, binds, preparable]
17+
[sql.freeze, binds, preparable, allow_retry]
1818
end
1919
end
2020
end

lib/pgpool_no_load_balance/active_record/relation/query_methods.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def pgpool_nlb_value
1515
end
1616

1717
def pgpool_nlb_value=(value)
18-
assert_mutability!
1918
@values[:pgpool_nlb] = value
2019
end
2120

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module PgpoolNoLoadBalance
2-
VERSION = "1.1.0"
2+
VERSION = "1.2.0"
33
end

pgpool_no_load_balance.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
2424
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2525
spec.require_paths = ["lib"]
2626

27-
spec.add_dependency "activerecord", ">= 5.2.0"
27+
spec.add_dependency "activerecord", ">= 7.2.0"
2828
end

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require "bundler/setup"
2+
require "active_record"
23
require "pgpool_no_load_balance"
34

45
RSpec.configure do |config|

0 commit comments

Comments
 (0)