aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-11-22 20:02:56 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-11-24 09:19:20 -0200
commitb69fd477e522654f8ae8c1d4ae3a1ee1ce965752 (patch)
treedc4cee0324771a8364499c5235968f6ea89f68e4 /activerecord/lib/active_record/relation.rb
parent36ee5802a5e52e0720eaa80fd0473fd131ffe890 (diff)
downloadrails-b69fd477e522654f8ae8c1d4ae3a1ee1ce965752.tar.gz
rails-b69fd477e522654f8ae8c1d4ae3a1ee1ce965752.tar.bz2
rails-b69fd477e522654f8ae8c1d4ae3a1ee1ce965752.zip
Move initialize_copy method around to let new method / build alias closer
Diffstat (limited to 'activerecord/lib/active_record/relation.rb')
-rw-r--r--activerecord/lib/active_record/relation.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb
index 3ee55c580e..f0f170b684 100644
--- a/activerecord/lib/active_record/relation.rb
+++ b/activerecord/lib/active_record/relation.rb
@@ -31,6 +31,14 @@ module ActiveRecord
@default_scoped = false
end
+ def initialize_copy(other)
+ # This method is a hot spot, so for now, use Hash[] to dup the hash.
+ # https://bugs.ruby-lang.org/issues/7166
+ @values = Hash[@values]
+ @values[:bind] = @values[:bind].dup if @values.key? :bind
+ reset
+ end
+
def insert(values)
primary_key_value = nil
@@ -90,14 +98,6 @@ module ActiveRecord
scoping { @klass.new(*args, &block) }
end
- def initialize_copy(other)
- # This method is a hot spot, so for now, use Hash[] to dup the hash.
- # https://bugs.ruby-lang.org/issues/7166
- @values = Hash[@values]
- @values[:bind] = @values[:bind].dup if @values.key? :bind
- reset
- end
-
alias build new
# Tries to create a new record with the same scoped attributes