I am using friendly_id gem to have pretty urls in my application.I want an url like:
localhost:3000/posts/1/my-first-post
I want to do it using the friendly_id gem as i want to use the History module to avoid 404 error.I have tried but can't include the id in the slug.The code i am using is follows:
class Post < ActiveRecord::Base
extend FriendlyId
friendly_id :pretty_url, use: [:slugged, :history]
def pretty_url
"#{id}/#{title}"
end
end
But it is not including the id in the slug.Rather it is using the slug as if only title is used.