text: I have a RoR app. And in app users can create posts. I've connected Posts table in my
  routes.rb
  resources :posts
  link
  @post.link = @post.theme.parameterize.underscore
  post/1
  @post.link
  The technique is referred to as
  slugifying and you need to do three things...
  (1) create a new field called
  slug in your
  posts table.
  (2) add this code to your
  Post model...
  after_validation :generate_slug def generate_slug self.slug = theme.parameterize.underscore end def to_param slug end
  (3) finally, in your controllers where you have
  find_post methods, rewrite it to be...
  def find_post post.find_by_slug(params[:id]) end
  The
  to_param method in the model is how things like
  post_path(@post) build the url... the
  to_param if not replaced substituted the
  id field but by writing your own
  to_param method you can ensure that the
  slug field is substituted instead.