Routes problem

I want to connect default route to controller Report::SalesController,
so I have line:
map.connect ‘’, :controller => ‘report/sales’
in config/routes.rb

SalesController is in app/controllers/report/sales.rb
and is declared as:
class Report::SalesController < ApplicationController


The problem is that when I try to open root url of my application I
get error message:
uninitialized constant SalesController

What I’m doing wrong?

if you have this route:

map.connect ‘’, :controller => ‘report/sales’

your controller would have to be named like this (as far as i know):

class SalesController < ApplicationController

On 13 November 2006 14:26, Domas S. wrote:

What I’m doing wrong?
The problem is that file with your controller should be named
sales_controller.rb (like class name, but underscored). Rails classes
loaded on demand and without proper naming Rails will not find which
file to

So how can I write a route that redirects to Report::SalesController?

Try this:

map.connect ‘’, :controller => '/report/sales

Sorry, I mistyped controller file name, it is actually:

So it seems that rails can’t guess controller class if it’s inside of
I created this controller using:
ruby script/generate controller report/sales

So it seems to be supported. And I can activate the controller by going

So the problem is only with routing.