This project is archived and is in readonly mode.

#6139 ✓wontfix
Tim McEwan

controller generator w/ module/namespace generates incorrect routes

Reported by Tim McEwan | December 9th, 2010 @ 01:02 PM

Generating a controller in a module/namespace is advertised by the generator help text, but the generated routes are incorrect.

For example:
rails g controller One/Two edit index new show generates four separate routes:

get "two/edit"
get "two/index"
get "two/new"
get "two/show"

...and the accompanying functional tests fail.

It should really generate four namespaced routes:

namespace :one do
  get "two/edit"
  get "two/index"
  get "two/new"
  get "two/show"
end the accompanying generated functional tests pass!

Comments and changes to this ticket

  • Andrew White

    Andrew White February 14th, 2011 @ 01:04 PM

    • State changed from “new” to “wontfix”
    • Importance changed from “” to “Low”

    Since the generated routes are pretty much always going to be rewritten and it isn't necessarily the case that a namespaced controller is namespaced within the url I don't think that it's worth the development effort to get this to work. I do appreciate that we are generating tests that are broken out of the box but the generated code is a starting point and not the finished article.

    Additionally with namespaced engines coming in Rails 3.1 there'll be even more instances where a namespaced controller does not namespace its urls - in fact there's even a test to ensure that it doesn't.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>