I am using friendly_id gem for slugging my models. Since the slug has to be unique when i enter the same data to check i get a long hashed appending in the slug.
I would recommend using the :scoped
module if you want to avoid UUIDs in your slugs when dealing with collisions. Here's the documentation along with an example:
http://norman.github.io/friendly_id/file.Guide.html#Unique_Slugs_by_Scope
Try using :scope => :id
since each id will be unique anyway and see if that works for you.
UPDATE:
To get exactly what you want, you now have candidates for that purpose in version 5:
class YourModel < ActiveRecord::Base
extend FriendlyId
friendly_id :slug_candidates, use: :slugged
# Try building a slug based on the following fields in
# increasing order of specificity.
def slug_candidates
[
:name,
[:name, :id],
]
end
end