Rails 5.2 Has And Belongs To Many with UUID


When using UUIDs and you are creating a join table like so:

You will get a migration file like so:

You’ll need to modify it accordingly:

Then run:

And you should be good. Just remember if you are using UUIDs you might want to make sure all models you generate use UUIDs.

In config/application.rb:

And make sure your generated migrations have:


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.