Hi All, I''ve got a small problem with map.root in the following code: map.root :controller => "site_manager", :action => :index It would appear that, for whatever reason, it isn''t calling the "index" action on my controller and my "@sites" var isn''t getting set for the view. It simply throws a "nil object" error. In the short term I''ve solved it with "@sites ||= Site.find(:all)" inside the view. Howevever, I''d like to know why it might be failing in the first place. Thoughts? It is noteworthy that when I manually navigate to "/sitemanager" or "/ site_manager" everything works fine. It simply appears to be a map.root issue. Best
Maurício Linhares
2009-Jun-17 14:00 UTC
Re: Why is map.root not calling action to set vars...?
Have you deleted the index.html file under the public folder? - Maurício Linhares http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr On Wed, Jun 17, 2009 at 10:53 AM, gberz3<gberz3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi All, > > I''ve got a small problem with map.root in the following code: > > > map.root :controller => "site_manager", :action => :index > > > It would appear that, for whatever reason, it isn''t calling the > "index" action on my controller and my "@sites" var isn''t getting set > for the view. It simply throws a "nil object" error. In the short > term I''ve solved it with "@sites ||= Site.find(:all)" inside the > view. Howevever, I''d like to know why it might be failing in the > first place. Thoughts? > > It is noteworthy that when I manually navigate to "/sitemanager" or "/ > site_manager" everything works fine. It simply appears to be a > map.root issue. > > Best > > >
2009/6/17 gberz3 <gberz3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > Hi All, > > I''ve got a small problem with map.root in the following code: > > > map.root :controller => "site_manager", :action => :index > >Try removing the :action =>:index specification (ie just spec the controller), or use "index" instead of :index. I don''t know why these would fix it but I have seen suggestions that they may. Colin> It would appear that, for whatever reason, it isn''t calling the > "index" action on my controller and my "@sites" var isn''t getting set > for the view. It simply throws a "nil object" error. In the short > term I''ve solved it with "@sites ||= Site.find(:all)" inside the > view. Howevever, I''d like to know why it might be failing in the > first place. Thoughts? > > It is noteworthy that when I manually navigate to "/sitemanager" or "/ > site_manager" everything works fine. It simply appears to be a > map.root issue. > > Best > > >
Yeah I deleted the "index" page. From the error it goes beyond that. On Jun 17, 10:00 am, Maurício Linhares <mauricio.linha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Have you deleted the index.html file under the public folder? > > - > Maurício Linhareshttp://codeshooter.wordpress.com/|http://twitter.com/mauriciojr > > > > On Wed, Jun 17, 2009 at 10:53 AM, gberz3<gbe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi All, > > > I''ve got a small problem with map.root in the following code: > > > map.root :controller => "site_manager", :action => :index > > > It would appear that, for whatever reason, it isn''t calling the > > "index" action on my controller and my "@sites" var isn''t getting set > > for the view. It simply throws a "nil object" error. In the short > > term I''ve solved it with "@sites ||= Site.find(:all)" inside the > > view. Howevever, I''d like to know why it might be failing in the > > first place. Thoughts? > > > It is noteworthy that when I manually navigate to "/sitemanager" or "/ > > site_manager" everything works fine. It simply appears to be a > > map.root issue. > > > Best
Wow! That appears to have fixed it. I *know* I tried that before. Oh well, thanks! On Jun 17, 10:03 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2009/6/17 gberz3 <gbe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > Hi All, > > > I''ve got a small problem with map.root in the following code: > > > map.root :controller => "site_manager", :action => :index > > Try removing the :action =>:index specification (ie just spec the > controller), or use "index" instead of :index. I don''t know why these > would fix it but I have seen suggestions that they may. > > Colin > > > > > It would appear that, for whatever reason, it isn''t calling the > > "index" action on my controller and my "@sites" var isn''t getting set > > for the view. It simply throws a "nil object" error. In the short > > term I''ve solved it with "@sites ||= Site.find(:all)" inside the > > view. Howevever, I''d like to know why it might be failing in the > > first place. Thoughts? > > > It is noteworthy that when I manually navigate to "/sitemanager" or "/ > > site_manager" everything works fine. It simply appears to be a > > map.root issue. > > > Best