Remove deprecated support to quote `ActiveRecord::Base` objects
This commit is contained in:
parent
5952493e50
commit
8311df47a6
|
@ -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*
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue