【问题标题】:how do i go about debugging this?我该如何调试呢?
【发布时间】:2012-05-07 14:10:51
【问题描述】:

我最近刚刚开始了这个 ruby​​ on rails 教程,以开始我对新语言的新冒险,但按照教程我被卡住了。在我将 index.html.erb 文件编辑为教程正在执行的操作后,我的 localhost 服务器给了我一个错误

**Routing Error**
No route matches [GET] "/"

我真的不知道如何调试这个

这是索引文件中的内容

<% @snippet.each do |snippet| %>
<h2><%= snippet.title %></h2>
<%end%>

对于我的路线:

Josegomez::Application.routes.draw do
resources :snippets

这是我一直关注的视频,虽然它要求你成为会员,但我想大多数人会问这个问题http://tutsplus.com/tutorial/how-to-deploy-your-first-rails-app/

这是我输入 rake 路线时得到的结果

Jose-Gomezs-MacBook-Pro:josegomez josegomez$ rake routes
    snippets GET    /snippets(.:format)          snippets#index
             POST   /snippets(.:format)          snippets#create
 new_snippet GET    /snippets/new(.:format)      snippets#new
edit_snippet GET    /snippets/:id/edit(.:format) snippets#edit
     snippet GET    /snippets/:id(.:format)      snippets#show
             PUT    /snippets/:id(.:format)      snippets#update
             DELETE /snippets/:id(.:format)      snippets#destroy

您可能正在使用旧版本...

【问题讨论】:

    标签: ruby-on-rails ruby debugging localhost


    【解决方案1】:

    你需要路由到根目录

    将此添加到 routes.rb

    root :to => 'snippets#index'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-15
      • 1970-01-01
      • 2015-07-14
      • 2012-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多