paint-brush
How to use Hash ID’s in your URL in Ruby on Rails 5by@rob__race
7,517 reads
7,517 reads

How to use Hash ID’s in your URL in Ruby on Rails 5

by Rob Race3mJanuary 26th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

When I am building a Rails app that I expect to be public facing in some sort of capacity, I don’t want to be displaying auto-incrementing, integer based IDs in my URLs. Not only does it visually look better, in my opinion. It is a security enhancement by removing the predictability of record discovery via the URL. Though, as ingrained as auto-incremented integer primary keys are in ActiveRecord, I wouldn’t want to rock the boat too much. Some suggest using UUIDs but I find them to be too long for URLs in my taste. So, I set out on how to use Hashes as IDs in my URL and would like to share that with you.

Company Mentioned

Mention Thumbnail
featured image - How to use Hash ID’s in your URL in Ruby on Rails 5
Rob Race HackerNoon profile picture
Rob Race

Rob Race

@rob__race

L O A D I N G
. . . comments & more!

About Author

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite