提交 bd78d24b 编写于 作者: A Aaron Patterson

be kind to the garbage collector and reuse our visitor object

上级 83633b80
......@@ -1270,7 +1270,10 @@ def sanitize_sql_hash_for_conditions(attrs, default_table_name = self.table_name
attrs = expand_hash_conditions_for_aggregates(attrs)
table = Arel::Table.new(self.table_name, :engine => arel_engine, :as => default_table_name)
PredicateBuilder.build_from_hash(arel_engine, attrs, table).map{ |b| b.to_sql }.join(' AND ')
viz = Arel::Visitors.for(arel_engine)
PredicateBuilder.build_from_hash(arel_engine, attrs, table).map { |b|
viz.accept b
}.join(' AND ')
end
alias_method :sanitize_sql_hash, :sanitize_sql_hash_for_conditions
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册