RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: besi
Like the URL to this very page, I want to have urls like this:
So I use friendly_id like so:
friendly_id :slug_candidates, use: :history
Now, since friendly id generates the slug before the object is saved I end up with an url like so (Please note the missing id in the URL):
Now while this is not too bad as such. As soon as I save another Product called "Table Lamp", I will get an URL like this:
So my question is, how can I make sure, friendly ID creates the slug containing the ID as well.