Upgrade from 1.2.3 to 1.2.4 broke my restful routes with :collection et al routes

Ok I see that they replaced the ; in some routes with / however this
seems to have broken all my restful routes that use…

map.resources :places, :collection => { :tagged => :get }

Now the URL that is generated is /places/tagged (used to be /
places;tagged) and I get the error

Couldn’t find Place with ID=tagged

So I presume there is something else I need to do, but what? There is
no mention of these routes breaking.

If I do /places/tagged/1 it works but I don;t have an id to pass on
these routes.

Thanks for any help.

Oh well I guess it was my fault.

The upgrade and change to the routes exposed something that wasn’t a
problem in 1.2.3

It turns out that you can and should do this…

map.resources :places, :collection => { :tagged => :get, :top
=> :get }, :member => { :rate => :put }

rather than have this…

map.resources :places, :member => { :rate => :put }
map.resources :places, :collection => { :tagged => :get }
map.resources :places, :collection => { :top => :get }

The latter is what was causing my problems, as it generates duplicate
conflicting routes. whereas before the routes were not conflicting.

All works now.

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