Vince W. wrote:
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/routing.1.patch
Anyone have any insights on this? I'm pretty much stumped..
map.connect '/foo/:param1/:param2', :controller => "foo", :requirements => { :param1 => /.*/ }
Vince W. wrote:
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: JvoorHis.com is for sale | HugeDomains)
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.