Maximus S
Maximus S

Reputation: 11125

Rails Simple Routing

I can't understand why this simple routing isn't working right now.

The link below doesn't work: it gives routing error No route matches [DELETE] "/questions"

<%= link_to 'delete', @question, :method => :delete, :action => :destroy %>

rake routes shows

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

correctly.

Does anyone can find the reason for this error?

Upvotes: 0

Views: 43

Answers (1)

Soundar Rathinasamy
Soundar Rathinasamy

Reputation: 6728

Try

<%= link_to 'delete', question_path(@question), :method => :delete, :confirm => "Are you sure?" %>

Upvotes: 1

Related Questions