diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-05-01 21:24:43 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-05-01 21:24:56 -0300 |
commit | 14a75a54a802b35db5a7802eca90dae9aa8e3518 (patch) | |
tree | 76af0639a4b6257377da9745e5e5271d3ffeedb3 /activerecord/lib | |
parent | 8a7c2e1cdff094da549be2b4ee3c04aec1c63d5a (diff) | |
download | rails-14a75a54a802b35db5a7802eca90dae9aa8e3518.tar.gz rails-14a75a54a802b35db5a7802eca90dae9aa8e3518.tar.bz2 rails-14a75a54a802b35db5a7802eca90dae9aa8e3518.zip |
Improve docs for postgresql with uuid primary keys [ci skip]
Introduced in 09ac1776abc0d3482f491f2d49f47bcb3d9a4ad7.
Diffstat (limited to 'activerecord/lib')
-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()') |