提交 1fb78e3e 编写于 作者: P Pratik Naik

Base.merge_conditions is no longer needed

上级 909443ea
......@@ -1238,20 +1238,6 @@ 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
def unscoped
@unscoped ||= Relation.new(self, arel_table)
finder_needs_type_condition? ? @unscoped.where(type_condition) : @unscoped
......
......@@ -167,8 +167,8 @@ def build_where(*args)
builder = PredicateBuilder.new(table.engine)
conditions = if [String, Array].include?(args.first.class)
merged = @klass.send(:merge_conditions, args.size > 1 ? Array.wrap(args) : args.first)
Arel::SqlLiteral.new(merged) if merged
sql = @klass.send(:sanitize_sql, args.size > 1 ? args : args.first)
Arel::SqlLiteral.new("(#{sql})") if sql.present?
elsif args.first.is_a?(Hash)
attributes = @klass.send(:expand_hash_conditions_for_aggregates, args.first)
builder.build_from_hash(attributes, table)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册