I'm using friendly_id and rails 3.2. I'm trying to convert a products table to have clean urls. I'm having no issues using the new slug column, and urls are generating fine like
example.com/products/new-friendly-url
The problem I am running into, is I still want to keep the unique id from active record, or some other unique identifier. The reason being, is that many product might have the same friendly title. If I have a product that has the exact same title, the current behavior is generating a slug with some unique identify already such as:
example.com/products/new-friendly-url--2
So friendly_id is generating unique slugs, but I'm just trying to change the format and not sure where/how to do that.
Is there a way to remove the extra --, and just have one "-" that friendly_id is adding?
Here is my model
class Product < ActiveRecord::Base
extend FriendlyId
friendly_id :title, :use => :slugged
attr_accessible :description, :image, :posted_by, :title, :url,
:price
validates_format_of :price, :with => /^[0-9]+$/
belongs_to :user
has_many :comments