提交 e328bdaa 编写于 作者: J Jeremy Kemper

Make Base.merge_conditions public

上级 d7b3c339
......@@ -1297,6 +1297,20 @@ def sti_name
store_full_sti_class ? name : name.demodulize
end
# Merges conditions so that the result is a valid +condition+
def merge_conditions(*conditions)
segments = []
conditions.each do |condition|
unless condition.blank?
sql = sanitize_sql(condition)
segments << sql unless sql.blank?
end
end
"(#{segments.join(') AND (')})" unless segments.empty?
end
private
def find_initial(options)
options.update(:limit => 1)
......@@ -1484,20 +1498,6 @@ def merge_includes(first, second)
(safe_to_array(first) + safe_to_array(second)).uniq
end
# Merges conditions so that the result is a valid +condition+
def merge_conditions(*conditions)
segments = []
conditions.each do |condition|
unless condition.blank?
sql = sanitize_sql(condition)
segments << sql unless sql.blank?
end
end
"(#{segments.join(') AND (')})" unless segments.empty?
end
# Object#to_a is deprecated, though it does have the desired behavior
def safe_to_array(o)
case o
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册