Controllers in modules, not recognised - driving me mad!

Hi, I hope somebody can help me here but I’m having a very strange
problem getting Rails to recognise controllers inside modules. The
strange thing is, it was working the other day and I’ve not changed
anything as far as I’m aware. I’m running on OSX using Ruby 1.8.4 and
Rails RC1 (but I’ve also tried rolling back to Rails 1.0 and tried Edge
Rails) and the problem occurs using lighty, webrick and when I run my
functional tests (I have a few assert_routings).

I have a Dashboard controller in an admin module. I have the following


class Admin::DashboardController < ActionController::Base
def index
# do stuff

Now, this should be automatically picked up by Rails as
http://myapp/admin/dashboard and http://myapp/admin/dashboard/index -
but they aren’t, I get routing errors.

I also have the following test:

require File.dirname(FILE) + ‘/…/test_helper’

class RoutingTest < Test::Unit::TestCase
def setup
@request =
@response =

def test_admin_routing
assert_routing ‘/admin’, :controller => ‘admin/dashboard’, :action
=> ‘index’
assert_routing ‘/admin/dashboard’, :controller =>
‘admin/dashboard’, :action => ‘index’

These tests fail.

What could be happening here? There isn’t anything revealing in my logs,
and like I said this was working the other day - they only work I’ve
been doing on my app since then is on one of my model classes and its
unit tests - I’ve not been touching my views/controllers.

Here’s the relevant exerpt from my logs:

Processing Base#index (for at 2006-03-27 00:34:05) [GET]
Session ID: 6145b5c6d7884639db0adc70113f5e86
Parameters: {}

ActionController::RoutingError (Recognition failed for
recognition_failed' .//vendor/rails/actionpack/lib/action_controller/routing.rb:478:inrecognize!’
.//vendor/rails/railties/lib/dispatcher.rb:38:in dispatch' .//vendor/rails/railties/lib/webrick_server.rb:115:inhandle_dispatch’
.//vendor/rails/railties/lib/webrick_server.rb:81:in service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/local/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:95:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:23:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in start' .//vendor/rails/railties/lib/webrick_server.rb:67:indispatch’

(404 Page Not Found)

OK I finally worked this out after much hairpulling! The aforementioned
model I had been working on was called Admin and this was conflicting
with the ‘admin’ module.

Thank you for this! I’ve also been pulling my hair, but no more! Thanks!

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