Skip to content

Commit 8311df4

Browse files
committed
Remove deprecated support to quote ActiveRecord::Base objects
1 parent 5952493 commit 8311df4

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

activerecord/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated support to quote `ActiveRecord::Base` objects.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecacated support to resolve connection using `"primary"` as connection specification name.
26

37
*Rafael Mendonça França*

activerecord/lib/active_record/connection_adapters/abstract/quoting.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ module Quoting
99
# Quotes the column value to help prevent
1010
# {SQL injection attacks}[https://en.wikipedia.org/wiki/SQL_injection].
1111
def quote(value)
12-
if value.is_a?(Base)
13-
ActiveSupport::Deprecation.warn(<<~MSG)
14-
Passing an Active Record object to `quote` directly is deprecated
15-
and will be no longer quoted as id value in Rails 7.0.
16-
MSG
17-
value = value.id_for_database
18-
end
19-
2012
_quote(value)
2113
end
2214

activerecord/test/cases/quoting_test.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,6 @@ def teardown
264264
@connection.drop_table :datetime_primary_keys, if_exists: true
265265
end
266266

267-
def test_quote_ar_object
268-
value = DatetimePrimaryKey.new(id: @time)
269-
expected = "'2017-02-14 12:34:56.789000'"
270-
assert_deprecated do
271-
assert_equal expected, @connection.quote(value)
272-
end
273-
end
274-
275267
def test_type_cast_ar_object
276268
value = DatetimePrimaryKey.new(id: @time)
277269
expected = @connection.type_cast(value.id)

guides/source/7_0_release_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ Please refer to the [Changelog][active-record] for detailed changes.
118118

119119
* Remove deprecacated support to resolve connection using `"primary"` as connection specification name.
120120

121+
* Remove deprecated support to quote `ActiveRecord::Base` objects.
122+
121123
### Deprecations
122124

123125
### Notable changes

0 commit comments

Comments
 (0)