views:

209

answers:

1

I have a named route:

map.find '/find/:category/:state/:search_term/:permalink', :search_term=>nil, :controller=>'find', :action=>'show_match'

and the following URL matches it & works OK:

http://localhost:3000/find/cars/ca/TestSeachTerm/bumpedupphoto-test

but if I take out the 2nd last parameter i.e. "TestSearchTerm", then the route fails to get matched, even though I have :search_term=>nil in the route.

http://localhost:3000/find/cars/ca//bumpedupphoto-test

Can anyone see what I am doing wrong? Being trying to solve this for a few days now.

Thanks!

+1  A: 

Add this after your current route:

map.find '/find/:category/:state/:permalink', :controller=>'find', :action=>'show_match'
Zepplock
Thanks for that.When I put that in as a route, rails cannot seem to decide which route to use:You have a nil object when you didn't expect it!The error occurred while evaluating nil.has_key?
Jason
what line of code is giving you that message?
Zepplock