Skip to content

Commit 04a63ad

Browse files
authored
Merge pull request rails#53717 from westonganger/recommend_arel_sql_instead_of_sanitize_sql_array
Add note about Arel.sql in documentation for sanitize_sql_array
2 parents 920a7e6 + 2337ee8 commit 04a63ad

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

activerecord/lib/active_record/sanitization.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ def sanitize_sql_like(string, escape_character = "\\")
161161
#
162162
# sanitize_sql_array(["role = ?", 0])
163163
# # => "role = '0'"
164+
#
165+
# Before using this method, please consider if Arel.sql would be better for your use-case
164166
def sanitize_sql_array(ary)
165167
statement, *values = ary
166168
if values.first.is_a?(Hash) && /:\w+/.match?(statement)

0 commit comments

Comments
 (0)