Last active
February 9, 2017 20:04
-
-
Save brainwire/ed97b9130cc9b4604e63d466f40d256a to your computer and use it in GitHub Desktop.
UUIDs
This file contains hidden or 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
Enabling UUIDs by default in Rails apps is easy. Just edit the config file: | |
# config/application.rb | |
config.active_record.primary_key = :uuid | |
You can use UUIDs for an individual table with Rails migrations: | |
create_table :users, id: :uuid do |t| | |
t.string :name | |
end | |
#Use | |
SecureRandom.uuid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment