I was trying to install gem FriendlyId. I am following railscast: 314-pretty-urls-with-friendlyid. It seems pretty easy to install. But not working for me.
Here are the steps I did:
added gem "friendly_id", "~> 4.0.9" in Gemfile
I then ran bundle install
command
Then modified my product model to this:
class Product < ActiveRecord::Base
extend FriendlyId
friendly_id :name
attr_accessible :name, :product_code, :recipe, :selling_price, :servings, letsrate_rateable "quality", "packaging", "hygiene" , "service", "price"
validates :name, :presence => true
class << self
def search(params)
if params[:search]
products = Product.published.includes(:product_sub_categories)
end
end
end
end
Still it is showing 'id':
http://localhost:3000/products/9
As per railscasts it should show product name. But it is not. I individually install gem but no effect.
Can anybody tell what I am missing?