In my app I'm trying to use url's like /foo/23/bar Everything works, except if there's a decimal. That is, I get a routing error if that 23 is a 23.5 or a 23.0. I saw a bug posted on escape chars and it looks like it should be fixed in Rails 1.2.3, but I'm still having issues. The patch, however, doesn't explicitly show it working with the period, just other chars like ? @ [ etc.. http://dev.rubyonrails.org/attachment/ticket/7544/... Anyone have any insights on this? I'm pretty much stumped..
on 2007-03-20 03:34
on 2007-03-20 03:44
Vince W. wrote: > Anyone have any insights on this? I'm pretty much stumped.. > map.connect '/foo/:param1/:param2', :controller => "foo", :requirements => { :param1 => /.*/ } -- Michael Wang
on 2007-03-20 03:54
Michael Wang wrote: > map.connect '/foo/:param1/:param2', :controller => "foo", :requirements > => { :param1 => /.*/ } > That didn't seem to work.. not sure if it's because I'm using restful routes. My actual routes snippet looks like this: map.resources :locations, :controller => 'home', :action => "index", :requirements => { :lat => /.*/ }, :member_path => "/locations/:lat,:lng,:distance" do |location| location.resources :categories do |categories| categories.resources :places, :name_prefix => 'category_' do |places| places.resources :addresses end end (I'm using the resource hacks plugin: http://www.jvoorhis.com/articles/2006/08/01/announ...)
on 2007-03-20 07:10
Vince W. wrote: > map.resources :locations, :controller => 'home', :action => "index", > (I'm using the resource hacks plugin: > http://www.jvoorhis.com/articles/2006/08/01/announ...) > Hmm...I haven't worked in that sort of setup before. You could try overriding what special characters are used for routing if you don't care about the routing by extension feature of Rails (e.g. route by .rss, .xml, etc.). The actual source is in: actionpack/lib/action_controller/routing.rb and the line that's sets up the special characters is: SEPARATORS = %w( / ; . , ? ) You can hack the source code directly or add something like this to your config/routes.rb file: ActionController::Routing::SEPARATORS = %w( / ; , ? ) You'll get a warning about modifying a constant but it should work. -- Michael Wang
on 2007-03-20 07:31
Michael Wang wrote: > > You'll get a warning about modifying a constant but it should work. And it does! *Thank you*
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.