Question

Ok so i have an application that i use this jquery

$("#band_events").load("/load_events/"+ escape($('#request_artist').val()), successCallback );

It works great but if #request_artist is R.E.M. or somehthing with decimals or something weird rails has problems like

ActionController::RoutingError (No route matches "/load_events/R.E.M." with {:method=>:get}):

here is my routes line

map.load_events '/load_events/:band', :controller => 'pages', :action => 'load_events'

Any suggestions

Was it helpful?

Solution

I would try

map.connect ... , :constraints => { :band => /.*/ }

(Or any other pattern of your taste.) About constraints

It doesn't seem to be working in all versions of rails, though. I'm pretty sure I used this trick before, but can't get it to work now. So, good luck with it.

OTHER TIPS

To escape a URL you should use encodeURIComponent instead of escape.

Check this out. This worked for me. Pretty neat solution, I would say - Ending a Rails 2 URL with an IP address causes routing error?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top