naliwajek

{ blog  github }

UUIDs in Rails generators

You want to use UUIDs instead of incremental IDs as your primary keys – because it’s a good idea – but Rails annoys you by still generating migration files with integers?

Then add this to configuration:

Rails.application.config.active_record.primary_key = :uuid

If you are not sure how to enable UUID extension in Rails, follow this article from folks at Arkency.

-

Thanks for reading, Jakub Naliwajek