This blog is part of our Rails 5 series.
UUIDs are a popular alternative to auto-incremental integer primary keys.
id: :uuid is passed to
This is all we need to do
to have UUID as primary key for
Now, if an application is designed
to use UUID instead of Integer,
then chances are that
new tables too would use UUID as primary key.
And it can easily get repetitive
every time a new model
Rails 5 comes up with
We need to set primary key as UUID
This automatically adds
id: :uuid to
in all future migrations.
One small recurrence off our plate.