Created
August 27, 2012 14:52
-
-
Save annacruz/3489202 to your computer and use it in GitHub Desktop.
UUID as primary key Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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