Permalink
Browse files

Relation#spawn is basically clone + reset

  • Loading branch information...
1 parent 8bdcb6f commit 24cc9e5b4f9b729f02d2e0b56265032d08933a41 @lifo lifo committed Jan 20, 2010
Showing with 2 additions and 12 deletions.
  1. +2 −12 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)

0 comments on commit 24cc9e5

Please sign in to comment.