diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 6040eeed00..654aac8453 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -340,10 +340,10 @@ module ActiveRecord # end # # By default, this will use the +uuid_generate_v4()+ function from the - # +uuid-ossp+ extension, which MUST be enabled on your databse. To enable + # +uuid-ossp+ extension, which MUST be enabled on your database. To enable # the +uuid-ossp+ extension, you can use the +enable_extension+ method in your - # migrations To use a UUID primary key without +uuid-ossp+ enabled, you can - # set the +:default+ option to nil: + # migrations. To use a UUID primary key without +uuid-ossp+ enabled, you can + # set the +:default+ option to +nil+: # # create_table :stuffs, id: false do |t| # t.primary_key :id, :uuid, default: nil @@ -354,11 +354,10 @@ module ActiveRecord # You may also pass a different UUID generation function from +uuid-ossp+ # or another library. # - # Note that setting the UUID primary key default value to +nil+ - # will require you to assure that you always provide a UUID value - # before saving a record (as primary keys cannot be nil). This might be - # done via the SecureRandom.uuid method and a +before_save+ callback, - # for instance. + # Note that setting the UUID primary key default value to +nil+ will + # require you to assure that you always provide a UUID value before saving + # 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()') |