Derek
Derek

Reputation: 1307

rails start create form url wrong

i flowed rails getting_started

in the 5.2 section “The first form”,the

http://localhost:3000/articles/new

success form

works fine before i add form “, url: create” how can i resolve this problem?

when i add url the result is:

enter image description here

and the rails run environment is:

➜ blog bin/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) articles#new

edit_article GET /articles/:id/edit(.:format) articles#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

➜ blog ruby -v

ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-darwin13.1.0]

➜ blog sqlite3 --version

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

➜ blog rails --version

Rails 4.2.1

Upvotes: 0

Views: 41

Answers (2)

Rubyrider
Rubyrider

Reputation: 3587

If you are just scaffolding, you are answer should be more simple:

<%= form_for @article do |f| %>

Your form should work now...

Upvotes: 0

Pavan
Pavan

Reputation: 33542

It should be

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

not

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

For more info, check this form_for

Upvotes: 1

Related Questions