Why is the route not finding the the decimal
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
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.
To escape a URL you should use encodeURIComponent
instead of escape
.
精彩评论