EncodedId is a Ruby gem that helps developers to obfuscate numerical or hex IDs in URLs while still keeping them human-friendly. It supports encoding multiple IDs at once, as well as slugged IDs (eg my-slug--<id>) and custom alphabets for the encoded strings. It also provides a profanity limitation and the ability to split the encoded string into groups of letters for improved readability.

coder = ::EncodedId::ReversibleId.new(salt: my_salt)
# => "p5w9-z27j"
# => "w72a-y0az"

The Rails gem provides a mixin for ActiveRecord models that allows you to easily add encoded IDs to your models.

class User < ApplicationRecord
  include EncodedId::WithEncodedId

# => #<User id: 78>