Incompatibility between 1.1.6 and 1.2 routing

Hi!

I just realized that edge ruby (1.2.2) breaks my routes. :id does not
include periods (".") any more, in favour of allowing :id.:format.

How can I create the old behevior, i.e. a route, so that “/controller/
action/abc.jpg” returns “abc.jpg” in a single argument (:id)?
“/:controller/:action/:id” does not work as expected and returns :id =
“abc”.

Thanks

Martin

Martin Aus Chemnitz wrote:

I just realized that edge ruby (1.2.2) breaks my routes. :id does not
include periods (".") any more, in favour of allowing :id.:format.

How can I create the old behevior, i.e. a route, so that “/controller/
action/abc.jpg” returns “abc.jpg” in a single argument (:id)?
“/:controller/:action/:id” does not work as expected and returns :id =
“abc”.

I’m sure there’s a more Ruby-like way of doing this but I just modified
the source code directly.

In rails/actionpack/lib/action_controller/routing.rb you’ll see this:

module Routing
SEPARATORS = %w( / ; . , ? )

Just take out the “.”


Michael W.

Martin Aus Chemnitz wrote:

Hi!

I just realized that edge ruby (1.2.2) breaks my routes. :id does not
include periods (".") any more, in favour of allowing :id.:format.

How can I create the old behevior, i.e. a route, so that “/controller/
action/abc.jpg” returns “abc.jpg” in a single argument (:id)?
“/:controller/:action/:id” does not work as expected and returns :id =
“abc”.

map.load_post_image ‘news/load_image/:id/:file_name’, :controller =>
‘news’, :action => ‘load_image’,
:requirements => { :file_name => /.*/ }

Cheers,
Jonathan


Jonathan W.
http://blog.innerewut.de

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs