How to get link_to in Rails output an SEO friendly url?

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2010-04-27T03:01:54Z Indexed on 2010/04/27 3:03 UTC
Read the original article Hit count: 313

Filed under:
|
|
|
|

Hi,

My link_to tag is:

<%= link_to("My test title",{:controller=>"search", :action=>"for-sale", :id=> listing.id, :title => listing.title, :search_term => search_term}) %>

and produces this ugly URL:

http://mysite.com/search/for-sale/12345?title=premium+ad+%2B+photo+%5Btest%5D

How can I get link_to to generate:

http://mysite.com/search/for-sale/listing-title/search-term/12345

Been trying this a few different ways and cannot find much online, really appreciate any help!

© Stack Overflow or respective owner

Related posts about rails

Related posts about link-to