Friendly_id: slug_candidates not naming slug properly
friendly-id, ruby-on-rails
Solution
The functionality you're describing is in version 5
See: https://github.com/norman/friendly_id#what-changed-in-version-50
What you've written is essentially just returning an array of symbols which is running through the parameterize method after it's cast to a string ...
2.0.0p247 :002 > ['name',['name',15]].to_s.parameterize # this is what friendly_id does in the background
=> "name-name-15"
Hope that helps
Problem
I have the following in my model: ``` class Dispenser < ActiveRecord::Base extend FriendlyId friendly_id :slug_candidates, use: :slugged def slug_candidates [ :full_name, [:full_name, :id] ] end end ``` This is generating slugs like: ``` => 'bob-barker-bob-barker-15' ``` Really it should be `bob-barker` or `bob-barker-15`, but not both. https://github.com/norman/friendly_id