aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-21 00:34:36 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-21 00:41:15 +0530
commit24cc9e5b4f9b729f02d2e0b56265032d08933a41 (patch)
treeed90f0e949563874384702be7d9a30eb9465a805 /activerecord
parent8bdcb6f072d503686dc56162c107d72762a67f7d (diff)
downloadrails-24cc9e5b4f9b729f02d2e0b56265032d08933a41.tar.gz
rails-24cc9e5b4f9b729f02d2e0b56265032d08933a41.tar.bz2
rails-24cc9e5b4f9b729f02d2e0b56265032d08933a41.zip
Relation#spawn is basically clone + reset
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation/spawn_methods.rb14
1 files changed, 2 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb
index 1577a9b116..cccf413e67 100644
--- a/activerecord/lib/active_record/relation/spawn_methods.rb
+++ b/activerecord/lib/active_record/relation/spawn_methods.rb
@@ -1,17 +1,7 @@
module ActiveRecord
module SpawnMethods
- def spawn(arel_table = self.table)
- relation = self.class.new(@klass, arel_table)
-
- (Relation::ASSOCIATION_METHODS + Relation::MULTI_VALUE_METHODS).each do |query_method|
- relation.send(:"#{query_method}_values=", send(:"#{query_method}_values"))
- end
-
- Relation::SINGLE_VALUE_METHODS.each do |query_method|
- relation.send(:"#{query_method}_value=", send(:"#{query_method}_value"))
- end
-
- relation
+ def spawn
+ clone.reset
end
def merge(r)