Adding this gem to a Rails application with PostgreSQL automatically enables UUID primary key.
Add this gem to your Rails application.
Add this line to your application's Gemfile:
And then execute:
This gem does two things to enable UUID primary key.
- Enable PostgreSQL's extension for calculation of UUID(v4).
- Configure generators to use UUID
- as primary key for newly generated tables.
- as type of references.
The gem is available as open source under the terms of the MIT License.