【问题标题】:Basic Rails3 routes question?基本 Rails3 路线问题?
【发布时间】:2010-12-09 03:26:04
【问题描述】:

我的routes.rb 有以下两行:

match "/",          :to => "main#index"
match "main/index", :to => "main#index"

当我在浏览器中输入 localhost:3000/main/index 时,我看到了正确的页面 (views/main/index.html.erb)。

但是,如果我只输入localhost:3000,我会看到public/index.html(我也希望看到views/main/index.html.erb)。

我错过了什么?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 routes


    【解决方案1】:

    删除public/index.html

    rm public/index.html
    

    这是因为静态文件(public/ 中的那些)优先于路由提供。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-18
      • 1970-01-01
      • 2016-09-23
      • 1970-01-01
      • 1970-01-01
      • 2016-10-31
      相关资源
      最近更新 更多