Deprecating resource routes in 1.2.x

As things stand currently, resource routing will broken in existing sites if/when they upgrade to Rails 2.0. I've added a patch to ticket 8558[1] that should work with both existing and 2.0 style resource routes, giving deprecation warnings when using route names that won't work in 2.0.

It passes all the tests and I've checked it against my own sites and everything appears to check out but I'd appreciate some feedback if it breaks anyone's existing sites (or some +1s if it doesn't!)

Thanks, ANdrew White

[1] http://dev.rubyonrails.org/attachment/ticket/8558/deprecated_resource_routing.2.diff

As things stand currently, resource routing will broken in existing sites if/when they upgrade to Rails 2.0. I've added a patch to ticket 8558[1] that should work with both existing and 2.0 style resource routes, giving deprecation warnings when using route names that won't work in 2.0.

It passes all the tests and I've checked it against my own sites and everything appears to check out but I'd appreciate some feedback if it breaks anyone's existing sites (or some +1s if it doesn't!)

Taking a look at this, my questions are:

1) Why are there still some hard coded semicolons in the route creation methods? 2) Shouldn't the seperator default to ; for 1.2.x and / for 2.x?

Apart from that, it's looking good.

1) Why are there still some hard coded semicolons in the route creation methods?

The routes with semi-colons in are just the deprecated routes - they should always be a semi-colon as there wasn't an option before. This addresses bitsweat's concern over breaking incoming links - even if some switches to 2.0 style routes the 1.2.x routes are still recognized. IMO, they should be permanently redirected to the new links but I thought that bitsweat wouldn't like that and it's straightforward to add a filter to do in ApplicationController.

2) Shouldn't the seperator default to ; for 1.2.x and / for 2.x?

This so that any new links generated are forward compatible with 2.x. Any routes that would've had a semi-colon are added by (1) above so defaulting to ; would only add duplicate routes - defaulting to / means that out of the box 1.2.4 and above will recognize both 1.2.3 and 2.0 urls.

Andrew White

ok, last query, the docs need to be updated to reference the new routes, and remove the reference to semicolons. Apart from that looks good to go!

Also want me to fix the docs on nested resources to refer to the 2.0 style prefixed named route helpers?

Andrew White