Darwinweb

Namespaced and Nested Routes Changed Slightly in Edge

September 12, 2007     

I run my app on a fixed version of edge and only upgrade when I need a new feature. Today bumping up the latest version I get bit by a small change to routing from late June. Changeset 7138 does a switcheroo within the RESTful named routes.

The change is that the action name is now always the first thing in the helper method name. This doesn’t affect regular routes, but it does affect nested or namespaced routes. So for instance:


map.namespace(:admin) do |admin|
  admin.resources :users
end

Used to produce the helper method:


  admin_new_user_url

But now produces:


  new_admin_user_url

This is one of the few changes in edge that will require a large number of changes to a lot of apps, but it feels like a worthwhile change. It took all of 5 minutes to fix my app, but I spent almost a half hour figuring out what broke. This change kind of slipped under my radar (no mention by Ryan), so I thought I’d post a note here hoping to save someone a few minutes.

Ryan Daigle says…
September 13, 2007 at 7:55AM

My bad, Gabe!