diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2016-07-17 21:52:36 +0300 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2016-07-17 21:52:36 +0300 |
commit | 6bb46ae2e8979479ba5603b50d8e07e07b46ba6d (patch) | |
tree | 3b560d2cf6c4012f5ed5fb00d2e3f1bcbb0d5a19 | |
parent | 849f79671b9efc014dddaa87b9f83844859e339e (diff) | |
download | rails-6bb46ae2e8979479ba5603b50d8e07e07b46ba6d.tar.gz rails-6bb46ae2e8979479ba5603b50d8e07e07b46ba6d.tar.bz2 rails-6bb46ae2e8979479ba5603b50d8e07e07b46ba6d.zip |
Refactored method `ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#default_sequence_name`
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb index 45507e206a..cc606e4828 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -327,12 +327,12 @@ module ActiveRecord end # Returns the sequence name for a table's primary key or some other specified key. - def default_sequence_name(table_name, pk = nil) #:nodoc: - result = serial_sequence(table_name, pk || 'id') + def default_sequence_name(table_name, pk = 'id') #:nodoc: + result = serial_sequence(table_name, pk) return nil unless result Utils.extract_schema_qualified_name(result).to_s rescue ActiveRecord::StatementInvalid - PostgreSQL::Name.new(nil, "#{table_name}_#{pk || 'id'}_seq").to_s + PostgreSQL::Name.new(nil, "#{table_name}_#{pk}_seq").to_s end def serial_sequence(table, column) |