# Route error with controllers in a module, should just work

**URL:** <https://www.ruby-forum.com/t/route-error-with-controllers-in-a-module-should-just-work/101310>\
**Category:** Rails\
**Created:** [August 4, 2006, 5:30am UTC](https://www.ruby-forum.com/t/route-error-with-controllers-in-a-module-should-just-work/101310 "2006-08-04T05:30:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew\_taylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@andrew\_taylor](https://www.ruby-forum.com/u/andrew_taylor)\
**Post date:** [August 4, 2006, 5:30am UTC](https://www.ruby-forum.com/t/route-error-with-controllers-in-a-module-should-just-work/101310/1 "2006-08-04T05:30:34Z")

</div>

This is ALL I have added to my routes.rb

map.connect ‘admin’, :controller =\> ‘/admin/welcome’

I have found plenty of examples saying this is correct if you have a  
WelcomeController in the Admin module, which I do 🙂

But now webrick won’t even start ??? Look at those 4 colons ::::, what  
is that about ?

help !

=\> Booting WEBrick…  
generated/routing/recognition.rb:38:in `write_recognition': compile error (SyntaxError) generated/routing/recognition.rb:35: parse error, unexpected tCOLON3, expecting tCONSTANT return {"controller" => ::::Admin::WelcomeController, "action" => "index"} ^ generated/routing/recognition.rb:35: dynamic constant assignment return {"controller" => ::::Admin::WelcomeController, "action" => "index"} ^ generated/routing/recognition.rb:35: parse error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' return {"controller" => ::::Admin::WelcomeController, "action" => "index"} ^ generated/routing/recognition.rb:35: parse error, unexpected '}', expecting kEND from c:/_/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12 .3/lib/action_controller/routing.rb:630:in`eval’  
from  
c:/_/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action\_controller/routing.rb:535:in  
 `write_recognition' from c:/_/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/routing.rb:630:in`draw’  
from ./script/…/config/…/config/routes.rb:1  
from  
c:/_/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:140:in  
`load' from c:/_/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/routing.rb:607:in`reload’  
from  
c:/_/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/initializer.rb:239:in  
 `initialize_routing' from c:/_/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/initializer.rb:105:in`process’  
… 7 levels…  
from  
c:/_/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/server.rb:30  
from  
c:/_/InstantRails/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
 `require' from c:/_/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in`require’  
from script/server:3  
/c/_/workspace/puffin\_server/puffin

---

<div class="post-metadata">

**Author:** ![andrew\_taylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@andrew\_taylor](https://www.ruby-forum.com/u/andrew_taylor)\
**Post date:** [August 5, 2006, 8:39pm UTC](https://www.ruby-forum.com/t/route-error-with-controllers-in-a-module-should-just-work/101310/2 "2006-08-05T20:39:27Z")

</div>

On 3-Aug-06, at 8:30 PM, andrew taylor wrote:

> 

Hi Andrew,

I wish I could give you an adequate explanation of what’s happening  
but for some reason my brain isn’t in gear today and (to be honest) I  
can’t be bothered sifting through rails’ code to make sure I’m talk  
talking rubbish.

So instead, I’ll just give you the quick version and solution.

map.connect ‘anchors’ the class name generated from the :controller  
=\> ‘/admin/welcome’ to the toplevel namespace by (apparently)  
_always_ putting ‘::’ in front of the generated class name.  
Unfortunately, you’re also trying to anchor the class name to the  
toplevel namespace by putting in that leading slash ‘/’ character.  
Which is _always_ converted to ‘::’.

Do this:

map.connect ‘admin’, :controller =\> ‘admin/welcome’

## HTH Trevor

Trevor S.  
[http://somethinglearned.com](http://somethinglearned.com)
