提交 6eaf5c92 编写于 作者: R Ryuta Kamizono

Deprecate `sanitize_conditions`. Use `sanitize_sql` instead

Because `sanitize_conditions` protected method is only used in one place.
上级 f857e1fd
* Deprecate `sanitize_conditions`. Use `sanitize_sql` instead.
*Ryuta Kamizono*
* Doing count on relations that contain LEFT OUTER JOIN Arel node no longer
force a DISTINCT. This solves issues when using count after a left_joins.
......
......@@ -62,8 +62,7 @@ def find_by_sql(sql, binds = [], preparable: nil)
#
# * +sql+ - An SQL statement which should return a count query from the database, see the example above.
def count_by_sql(sql)
sql = sanitize_conditions(sql)
connection.select_value(sql, "#{name} Count").to_i
connection.select_value(sanitize_sql(sql), "#{name} Count").to_i
end
end
end
......@@ -29,8 +29,9 @@ def sanitize_sql_for_conditions(condition)
else condition
end
end
alias_method :sanitize_sql, :sanitize_sql_for_conditions
alias_method :sanitize_conditions, :sanitize_sql
alias :sanitize_sql :sanitize_sql_for_conditions
alias :sanitize_conditions :sanitize_sql
deprecate sanitize_conditions: :sanitize_sql
# Accepts an array, hash, or string of SQL conditions and sanitizes
# them into a valid SQL fragment for a SET clause.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册