Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
run-rspec-tests:
strategy:
matrix:
version: ['7.0', '6.0']
version: ['7.2', '7.0', '6.0']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
14 changes: 10 additions & 4 deletions lib/safe_active_record/active_record_monkeypatch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,16 @@ class << self
alias safe_ar_original_sql sql

# sql takes in arguments of TrustedSymbol or UncheckedString type.
def sql(raw_sql)
raw_sql = SafeActiveRecord.check_arg(raw_sql, 0)

safe_ar_original_sql(raw_sql)
def sql(sql_string, *positional_binds, retryable: false, **named_binds)
raw_sql = SafeActiveRecord.check_arg(sql_string, 0)

if defined?(ActiveRecord::VERSION) &&
Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('7.2.0')
# If the version is >= 7.2.0, pass the `retryable` parameter.
safe_ar_original_sql(raw_sql, *positional_binds, retryable: retryable, **named_binds)
else
safe_ar_original_sql(raw_sql, *positional_binds, **named_binds)
end
end
end
end