user3565074
user3565074

Reputation: 71

Rails router doesn't see method post

in routes.rb i have line:

resources :comments

but when i come to /comments/create i see:

No route matches [POST] "/comments/create"

...

comments_path       GET     /comments(.:format)             comments#index
                    POST    /comments(.:format)             comments#create
new_comment_path    GET     /comments/new(.:format)         comments#new
edit_comment_path   GET     /comments/:id/edit(.:format)    comments#edit
comment_path        GET     /comments/:id(.:format)         comments#show
                    PATCH   /comments/:id(.:format)         comments#update
                    PUT     /comments/:id(.:format)         comments#update
                    DELETE  /comments/:id(.:format)         comments#destroy 

What is wrong? Class and action are exists.

Upvotes: 0

Views: 27

Answers (1)

Marek Lipka
Marek Lipka

Reputation: 51171

Look at line 2 in your rake routes output. You should POST to /comments in order to fire create action.

Upvotes: 2

Related Questions