diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-21 17:48:53 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-21 17:52:09 +0530 |
commit | da142cd86584d56299470ee4dd6f90be7127b477 (patch) | |
tree | aa20ecac64534a6b440b0978da3ec9768229377b /activerecord/lib/active_record/relation.rb | |
parent | 378464a2e47bb849f3351cb8c87366554b7ce74d (diff) | |
download | rails-da142cd86584d56299470ee4dd6f90be7127b477.tar.gz rails-da142cd86584d56299470ee4dd6f90be7127b477.tar.bz2 rails-da142cd86584d56299470ee4dd6f90be7127b477.zip |
Supplying Arel::SqlLiteral is much faster
Diffstat (limited to 'activerecord/lib/active_record/relation.rb')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index c9fff15199..04b85119cb 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -282,8 +282,11 @@ module ActiveRecord def scope_for_create @scope_for_create ||= begin - @create_with_value || wheres.inject({}) do |hash, where| - hash[where.operand1.name] = where.operand2.value if where.is_a?(Arel::Predicates::Equality) + @create_with_value || @where_values.inject({}) do |hash, where| + if where.is_a?(Arel::Predicates::Equality) + hash[where.operand1.name] = where.operand2.respond_to?(:value) ? where.operand2.value : where.operand2 + end + hash end end |