Scott Watermasysk Husband, Father, and KickoffLabs co-founder. Interests: basketball, bootstrapping, keyboards, training, and Building new things

Rails 5.1+ UUID As Primary Key

Published:

Handy guide for setting up UUID's as your primary key in Rails 5.1+.

Rails 5.1 + Using a UUID as a primary key in ActiveRecord with PostgreSQL

For PostgreSQL >= 9.4, ActiveRecord will now use pgcrypto’s gen_random_uuid function whereas previously uuid-ossp’s uuid_generate_v4 function was used.