RailsCasts Pro episodes are now free!
Learn more or hide this
There is a newer version of this episode, see the revised episode.
def to_param "#{id}-#{permalink}" end # controller @product = Product.find(params[:id])
or
def to_param permalink end # controller @product = Product.find_by_permalink(params[:id])