Use Hashids (http://hashids.org/ruby/) in your Rails app ActiveRecord models.
to_param
hashid
nil
find
find_by_hashid
find_by_hashid!