diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2014-12-27 07:40:33 -0700 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2014-12-27 07:40:33 -0700 |
commit | fc8d63854903f82db700eb8ca6a43ab81af7c0ce (patch) | |
tree | 90bb5161074846797565deee13ca18e944743f48 /activerecord/lib/active_record/connection_adapters | |
parent | de0cfd27a54545131d3ae756eb725a91ab4f0907 (diff) | |
parent | 11054049cac40c9d04d940eece155bfb5a7ba1f4 (diff) | |
download | rails-fc8d63854903f82db700eb8ca6a43ab81af7c0ce.tar.gz rails-fc8d63854903f82db700eb8ca6a43ab81af7c0ce.tar.bz2 rails-fc8d63854903f82db700eb8ca6a43ab81af7c0ce.zip |
Merge pull request #18221 from kamipo/refactor_table_definition_primary_key
Refactor `PostgreSQL::TableDefinition#primary_key`
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb index b37630a04c..a9522e152f 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb @@ -125,10 +125,8 @@ module ActiveRecord # a record (as primary keys cannot be +nil+). This might be done via the # +SecureRandom.uuid+ method and a +before_save+ callback, for instance. def primary_key(name, type = :primary_key, options = {}) - return super unless type == :uuid - options[:default] = options.fetch(:default, 'uuid_generate_v4()') - options[:primary_key] = true - column name, type, options + options[:default] = options.fetch(:default, 'uuid_generate_v4()') if type == :uuid + super end def new_column_definition(name, type, options) # :nodoc: |