Skip to content

Instantly share code, notes, and snippets.

@annacruz
Created August 27, 2012 14:52
Show Gist options
  • Save annacruz/3489202 to your computer and use it in GitHub Desktop.
Save annacruz/3489202 to your computer and use it in GitHub Desktop.
UUID as primary key Rails
When you're using UUID as primary key field your tests will be broken, so to fix it take there steps:
- Remove your db/schema.rb file
- Add the following line in your application.rb file
config.active_record.schema_format = :sql
- Then after you run your migrations and before you run rake db:test:prepare run:
rake db:structure:dump
With this your test database will be made with a sql file and import correctly your primary keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment