Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Relation#spawn is basically clone + reset

  • Loading branch information...
commit 24cc9e5b4f9b729f02d2e0b56265032d08933a41 1 parent 8bdcb6f
@lifo lifo authored
Showing with 2 additions and 12 deletions.
  1. +2 −12 activerecord/lib/active_record/relation/spawn_methods.rb
View
14 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)
Please sign in to comment.
Something went wrong with that request. Please try again.