diff options
author | Xavier Noria <fxn@hashref.com> | 2010-08-20 17:18:57 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-08-20 17:18:57 +0200 |
commit | 0c75ec51a9b60252125534b8f9a3f6406713a957 (patch) | |
tree | 34165e93f7dd01157f77e4e70a46ec6a5bed77c8 /activerecord/lib/active_record/relation.rb | |
parent | 87398e531d0bb23b30787fe26d86678dba322895 (diff) | |
parent | 2ffa50f5a9fac08e08869687006031b70322497a (diff) | |
download | rails-0c75ec51a9b60252125534b8f9a3f6406713a957.tar.gz rails-0c75ec51a9b60252125534b8f9a3f6406713a957.tar.bz2 rails-0c75ec51a9b60252125534b8f9a3f6406713a957.zip |
Merge remote branch 'rails/master'
Diffstat (limited to 'activerecord/lib/active_record/relation.rb')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index cfe4d23965..03b06205d4 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -316,16 +316,19 @@ module ActiveRecord @to_sql ||= arel.to_sql end - def scope_for_create - @scope_for_create ||= begin - @create_with_value || Hash[ - @where_values.find_all { |w| + def where_values_hash + Hash[@where_values.find_all { |w| w.respond_to?(:operator) && w.operator == :== }.map { |where| [where.operand1.name, where.operand2.respond_to?(:value) ? where.operand2.value : where.operand2] }] + end + + def scope_for_create + @scope_for_create ||= begin + @create_with_value || where_values_hash end end |