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
...
end
The problem is that when I try to open root url of my application I
get error message:
uninitialized constant SalesController
The problem is that file with your controller should be named
sales_controller.rb (like class name, but underscored). Rails classes are
loaded on demand and without proper naming Rails will not find which file to
load.
Sorry, I mistyped controller file name, it is actually:
app/controllers/report/sales_controller.rb
So it seems that rails can't guess controller class if it's inside of module.
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 to:
http://127,0,0,1:3000/report/sales