Ruby on Rails map.root 似乎不起作用 [英] Ruby on Rails map.root doesn't seem to be working
问题描述
我正在尝试获取应用程序的根以路由到默认控制器.从我读到的,这应该可以在我的 routes.rb 文件底部使用类似的内容:
I am trying to get the root of my application to route to a default controller. From what I read, this should be possible with something like this at the bottom of my routes.rb file:
map.root :controller => 'albums'
甚至:
map.home '', :controller => 'albums'
但是,当我尝试导航到 http://myhost:8000/ 时,我只看到了 Rails 欢迎页面.在对 routes.rb 进行更改后和测试之前,我正在使用以下命令重新启动应用程序:
However, when I try navigating to http://myhost:8000/, I just see the rails welcome page. I am restarting the application with the following command after making the change to routes.rb and before testing it:
sudo mongrel_cluster_ctl restart
以下是一些更可能相关的环境信息:
Here is some more possibly pertinent environment information:
% rails -v
Rails 2.3.3
% ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
我确定我遗漏了一些简单的东西,但我看不到它是什么.有什么想法吗?
I am sure I'm missing something simple, but I can't see what it is. Any ideas?
推荐答案
您是否删除了 Rails 创建的静态 public/index.html
页面?如果这仍然在您的应用中,它将显示而不是您在路由中定义的根页面.
Have you deleted the static public/index.html
page that Rails creates? If this is still in your app it will be shown instead of the root page you defined in the routes.
这篇关于Ruby on Rails map.root 似乎不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!