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 What I''m doing wrong? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 13 November 2006 14:26, Domas Savickas wrote:> 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 > > 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 are loaded on demand and without proper naming Rails will not find which file to load. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
So how can I write a route that redirects to Report::SalesController? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 So the problem is only with routing. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try this: map.connect '''', :controller => ''/report/sales -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Domas Savickas Sent: Monday, November 13, 2006 7:26 PM To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails] 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 ... end 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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---