aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/spawn_methods.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-01-03 10:04:40 +0000
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-03 16:24:32 -0800
commit1313d386dacb580858e5951418a637f4e17cf5c1 (patch)
tree6f86a5613768a1f705fa89d4497d037914bdf60c /activerecord/lib/active_record/relation/spawn_methods.rb
parent31d101879f1acae604d24d831a4b82a4482acf31 (diff)
downloadrails-1313d386dacb580858e5951418a637f4e17cf5c1.tar.gz
rails-1313d386dacb580858e5951418a637f4e17cf5c1.tar.bz2
rails-1313d386dacb580858e5951418a637f4e17cf5c1.zip
Make Relation#create_with always merge rather than overwrite, not just when merging two relations. If you wish to overwrite, you can do relation.create_with(nil), or for a specific attribute, relation.create_with(:attr => nil).
Diffstat (limited to 'activerecord/lib/active_record/relation/spawn_methods.rb')
-rw-r--r--activerecord/lib/active_record/relation/spawn_methods.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb
index a8fb1bccf4..db5f1af5ca 100644
--- a/activerecord/lib/active_record/relation/spawn_methods.rb
+++ b/activerecord/lib/active_record/relation/spawn_methods.rb
@@ -53,9 +53,7 @@ module ActiveRecord
merged_relation.lock_value = r.lock_value unless merged_relation.lock_value
- if r.create_with_value
- merged_relation.create_with_value = (merged_relation.create_with_value || {}).merge(r.create_with_value)
- end
+ merged_relation = merged_relation.create_with(r.create_with_value) if r.create_with_value
# Apply scope extension modules
merged_relation.send :apply_modules, r.extensions