Skip to content

Commit 240e9da

Browse files
committed
Remove deprecated #quote_bound_value
1 parent 465fbd7 commit 240e9da

File tree

4 files changed

+6
-50
lines changed

4 files changed

+6
-50
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 `#quote_bound_value`.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated `ActiveRecord::ConnectionAdapters::ConnectionPool#connection_klass`.
26

37
*Rafael Mendonça França*

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,6 @@ def type_cast(value)
4848
end
4949
end
5050

51-
# Quote a value to be used as a bound parameter of unknown type. For example,
52-
# MySQL might perform dangerous castings when comparing a string to a number,
53-
# so this method will cast numbers to string.
54-
#
55-
# Deprecated: Consider `Arel.sql("... ? ...", value)` or
56-
# +sanitize_sql+ instead.
57-
def quote_bound_value(value)
58-
ActiveRecord.deprecator.warn(<<~MSG.squish)
59-
#quote_bound_value is deprecated and will be removed in Rails 7.2.
60-
Consider Arel.sql(".. ? ..", value) or #sanitize_sql instead.
61-
MSG
62-
63-
quote(cast_bound_value(value))
64-
end
65-
6651
# Cast a value to be used as a bound parameter of unknown type. For example,
6752
# MySQL might perform dangerous castings when comparing a string to a number,
6853
# so this method will cast numbers to string.

activerecord/test/cases/adapters/abstract_mysql_adapter/quoting_test.rb

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,46 +20,11 @@ def test_cast_bound_rational
2020
assert_equal "0.75", @conn.cast_bound_value(Rational(3, 4))
2121
end
2222

23-
def test_cast_bound_duration
24-
expected = assert_deprecated(ActiveRecord.deprecator) { @conn.cast_bound_value(42.seconds) }
25-
assert_equal "42", expected
26-
end
27-
2823
def test_cast_bound_true
2924
assert_equal "1", @conn.cast_bound_value(true)
3025
end
3126

3227
def test_cast_bound_false
3328
assert_equal "0", @conn.cast_bound_value(false)
3429
end
35-
36-
def test_quote_bound_integer
37-
expected = assert_deprecated(ActiveRecord.deprecator) { @conn.quote_bound_value(42) }
38-
assert_equal "'42'", expected
39-
end
40-
41-
def test_quote_bound_big_decimal
42-
expected = assert_deprecated(ActiveRecord.deprecator) { @conn.quote_bound_value(BigDecimal("4.2")) }
43-
assert_equal "'4.2'", expected
44-
end
45-
46-
def test_quote_bound_rational
47-
expected = assert_deprecated(ActiveRecord.deprecator) { @conn.quote_bound_value(Rational(3, 4)) }
48-
assert_equal "'0.75'", expected
49-
end
50-
51-
def test_quote_bound_duration
52-
expected = assert_deprecated(ActiveRecord.deprecator) { @conn.quote_bound_value(42.seconds) }
53-
assert_equal "'42'", expected
54-
end
55-
56-
def test_quote_bound_true
57-
expected = assert_deprecated(ActiveRecord.deprecator) { @conn.quote_bound_value(true) }
58-
assert_equal "'1'", expected
59-
end
60-
61-
def test_quote_bound_false
62-
expected = assert_deprecated(ActiveRecord.deprecator) { @conn.quote_bound_value(false) }
63-
assert_equal "'0'", expected
64-
end
6530
end

guides/source/7_2_release_notes.md

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

157157
* Remove deprecated `ActiveRecord::ConnectionAdapters::ConnectionPool#connection_klass`.
158158

159+
* Remove deprecated `#quote_bound_value`.
160+
159161
### Deprecations
160162

161163
* Deprecate `Rails.application.config.active_record.allow_deprecated_singular_associations_name`

0 commit comments

Comments
 (0)