aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-03-04 22:18:57 +0900
committerkennyj <kennyj@gmail.com>2012-03-04 22:24:02 +0900
commit200d994870e0b2e59c31ab9d268def19abc563cf (patch)
treeee90f4d61d31ba740c834edbdeffc8730dd6f36d /activerecord/lib/active_record
parent640f6c201d59cd7fc16943154372d4ef754f33f4 (diff)
downloadrails-200d994870e0b2e59c31ab9d268def19abc563cf.tar.gz
rails-200d994870e0b2e59c31ab9d268def19abc563cf.tar.bz2
rails-200d994870e0b2e59c31ab9d268def19abc563cf.zip
Don't clear sequence name when we explicitly assign it.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/model_schema.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb
index 8710884bfd..73c9e22aa3 100644
--- a/activerecord/lib/active_record/model_schema.rb
+++ b/activerecord/lib/active_record/model_schema.rb
@@ -123,7 +123,7 @@ module ActiveRecord
@table_name = value
@quoted_table_name = nil
@arel_table = nil
- @sequence_name = nil
+ @sequence_name = nil unless defined?(@explicitly_sequence_name) && @explicitly_sequence_name
@relation = Relation.new(self, arel_table)
end
@@ -170,7 +170,8 @@ module ActiveRecord
end
def reset_sequence_name #:nodoc:
- self.sequence_name = connection.default_sequence_name(table_name, primary_key)
+ @sequence_name = connection.default_sequence_name(table_name, primary_key)
+ @explicitly_sequence_name = false
end
# Sets the name of the sequence to use when generating ids to the given
@@ -189,6 +190,7 @@ module ActiveRecord
# end
def sequence_name=(value)
@sequence_name = value.to_s
+ @explicitly_sequence_name = true
end
# Indicates whether the table associated with this class exists