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


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 ugly url:

http://mysite.com/search/for-sale/12345?title=premium+ad+%2b+photo+%5btest%5d 

how can link_to generate:

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

been trying few different ways , cannot find online, appreciate help!

tahe @ this

add in config/routes.rb

map.connect ':controller/:action/:title/search_item/:id', :controller=>'search', :action=>'for_sale'  

restart server , check. hope helps :)


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -