You can override the to_param method in your model.
So, if you have a model called Celebrity that has a name column, you can go:
class Celebrity < ActiveRecord::Base def to_param self.name.downcase.gsub(' ', '-') end end
Then:
jessica_alba = Celebrity.find_by_name("Jessica Alba") link_to "Jessica Alba", celebrity_path(jessica_alba)
source share