新手问题 form_for 错误,求指导 [已解决]

Vale · 2014年11月26日 · 最后由 tsaikoga 回复于 2015年02月16日 · 1708 次阅读

大家好,我是新手,目前正跟着 Ruby on Rails Guides 学习,在创建评论表单时出现了如下问题: 这个问题大概是哪里写错了?这个错误是按照这里 [http://guides.rubyonrails.org/getting_started.html#adding-a-second-model] 操作产生的。相对于在 Xcode 中写错字段会报错,Sublime Test2 安静多了啊。 谢谢大家。

6.3 Adding a Route for Comments As with the welcome controller, we will need to add a route so that Rails knows where we would like to navigate to see comments. Open up the config/routes.rb file again, and edit it as follows:

resources :articles do resources :comments end

#1 楼 @badboy 谢啦,不过这里我加了。


Rails.application.routes.draw do


  get 'welcome/index'

  resources :articles do
    resources :comments

  root 'welcome#index'
end

这样有问题吗?

@Vale


resources :articles do
  resources :comments
end

少了一个 end?

#3 楼 @realleo 哈哈,是啊,谢谢啦。

可以在标题前加上 [已解决]

需要 登录 后方可回复, 如果你还没有账号请 注册新账号