Hey, am i to stupid to find the information about how to route to a controller in a module? Maybe module support has gone! The controller is under: app/controllers/admin/my_controller.rb The my_controller.rb file looks like this: module Admin class MyController def index render :text => ''Hello!'' end end end How does a route to all controllers under module Admin look like? map.connect ''admin/:controller/:action/:id'', :module => ''admin'' This one gives me a NameError ''uninitialized constant DepartmentController'' I tested following with the same result: map.connect ''admin/my_controller/:action/:id'', :controller => ''admin/my_controller'' Are controllers within modules still supported? Ciao, Norman -- Norman Timmler - inlet media e.K. Phone: +49 (0)40 / 43 25 10 81 Fax: +49 (0)40 / 43 25 10 82 Holl?ndische Reihe 31 22765 Hamburg http://www.inlet-media.de
You probably want something more like this, in /app/controllers/admin/my_controller.rb: class Admin::MyController < ApplicationController ........ end Rails will create the Admin module using its own dark magicks. You shouldn''t need to touch the default controller route either. - james On 1/16/06, Norman Timmler <norman.timmler@inlet-media.de> wrote:> Hey, > > am i to stupid to find the information about how to route to a > controller in a module? Maybe module support has gone! > > The controller is under: > app/controllers/admin/my_controller.rb > > The my_controller.rb file looks like this: > module Admin > class MyController > def index > render :text => ''Hello!'' > end > end > end > > How does a route to all controllers under module Admin look like? > map.connect ''admin/:controller/:action/:id'', :module => ''admin'' > > This one gives me a NameError ''uninitialized constant > DepartmentController'' > > I tested following with the same result: > map.connect ''admin/my_controller/:action/:id'', :controller => > ''admin/my_controller'' > > Are controllers within modules still supported? > > Ciao, > Norman > -- > Norman Timmler - inlet media e.K. > > Phone: +49 (0)40 / 43 25 10 81 > Fax: +49 (0)40 / 43 25 10 82 > > Holl?ndische Reihe 31 > 22765 Hamburg > > http://www.inlet-media.de > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Am Montag, den 16.01.2006, 17:46 +0000 schrieb James Adam:> You probably want something more like this, in > /app/controllers/admin/my_controller.rb: > > class Admin::MyController < ApplicationController > ........ > end > > Rails will create the Admin module using its own dark magicks. You > shouldn''t need to touch the default controller route either.Sorry, but i figured out a typing error caused the problem ;) By the way, class Admin:Mycontroller and module Admin class MyController are the same, with the only difference, that the first one only works if the module has been declared before. -- Norman Timmler http://blog.inlet-media.de -- Norman Timmler - inlet media e.K. Phone: +49 (0)40 / 43 25 10 81 Fax: +49 (0)40 / 43 25 10 82 Holl?ndische Reihe 31 22765 Hamburg http://www.inlet-media.de
Am Montag, den 16.01.2006, 17:46 +0000 schrieb James Adam:> You probably want something more like this, in > /app/controllers/admin/my_controller.rb: > > class Admin::MyController < ApplicationController > ........ > end > > Rails will create the Admin module using its own dark magicks. You > shouldn''t need to touch the default controller route either.Sorry, but i figured out a typing error caused the problem ;) By the way, class Admin:Mycontroller and module Admin class MyController are the same, with the only difference, that the first one only works if the module has been declared before. -- Norman Timmler http://blog.inlet-media.de -- Norman Timmler - inlet media e.K. Phone: +49 (0)40 / 43 25 10 81 Fax: +49 (0)40 / 43 25 10 82 Holl?ndische Reihe 31 22765 Hamburg http://www.inlet-media.de