Remove deprecated support to quote `ActiveRecord::Base` objects

This commit is contained in:
Rafael Mendonça França 2021-11-17 19:21:11 +00:00
parent 5952493e50
commit 8311df47a6
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
4 changed files with 6 additions and 16 deletions

View File

@ -1,3 +1,7 @@
* Remove deprecated support to quote `ActiveRecord::Base` objects.
*Rafael Mendonça França*
* Remove deprecacated support to resolve connection using `"primary"` as connection specification name.
*Rafael Mendonça França*

View File

@ -9,14 +9,6 @@ module ActiveRecord
# Quotes the column value to help prevent
# {SQL injection attacks}[https://en.wikipedia.org/wiki/SQL_injection].
def quote(value)
if value.is_a?(Base)
ActiveSupport::Deprecation.warn(<<~MSG)
Passing an Active Record object to `quote` directly is deprecated
and will be no longer quoted as id value in Rails 7.0.
MSG
value = value.id_for_database
end
_quote(value)
end

View File

@ -264,14 +264,6 @@ module ActiveRecord
@connection.drop_table :datetime_primary_keys, if_exists: true
end
def test_quote_ar_object
value = DatetimePrimaryKey.new(id: @time)
expected = "'2017-02-14 12:34:56.789000'"
assert_deprecated do
assert_equal expected, @connection.quote(value)
end
end
def test_type_cast_ar_object
value = DatetimePrimaryKey.new(id: @time)
expected = @connection.type_cast(value.id)

View File

@ -118,6 +118,8 @@ Please refer to the [Changelog][active-record] for detailed changes.
* Remove deprecacated support to resolve connection using `"primary"` as connection specification name.
* Remove deprecated support to quote `ActiveRecord::Base` objects.
### Deprecations
### Notable changes