rails开始创建表单url错误

时间:2015-06-28 04:38:39

标签: ruby-on-rails

我流了rails getting_started

在5.2节“第一种形式”中,

http://localhost:3000/articles/new

success form

在我添加表单之前工作正常“,url:create”我该如何解决这个问题?

当我添加url时,结果为:

enter image description here

和rails运行环境是:

  

➜blogbin / rake routes

   Prefix Verb   URI Pattern                  Controller#Action

welcome_index GET /welcome/index(.:format)welcome #index

     root GET    /                            welcome#index

 articles GET    /articles(.:format)          articles#index

          POST   /articles(.:format)          articles#create

new_article GET /articles/new(.:format)文章#new

edit_article GET /articles/:id/edit(.:format)文章#edit

  article GET    /articles/:id(.:format)      articles#show

          PATCH  /articles/:id(.:format)      articles#update

          PUT    /articles/:id(.:format)      articles#update

          DELETE /articles/:id(.:format)      articles#destroy

➜博客ruby -v

ruby​​ 2.0.0p481(2014-05-08修订版45883)[x86_64-darwin13.1.0]

➜博客sqlite3 --version

3.7.13 2012-07-17 17:46:21 65035912264e3acbced5a3e16793327f0a2f17bb

➜blograils --version

Rails 4.2.1

2 个答案:

答案 0 :(得分:1)

应该是

<%= form_for :article, url: articles_path do |f| %>

<%= form_for :article, url: create do |f| %>

有关详细信息,请查看此form_for

答案 1 :(得分:0)

如果你只是脚手架,你的回答应该更简单:

ngRoute

你的表格现在应该有效......