Answer the question
In order to leave comments, you need to log in
Why do I send GET instead of DELETE in Rails 4.2.6?
There is a standard CRUD.
[email protected]:/var/www/remember$ rake routes
Prefix Verb URI Pattern Controller#Action
root GET / question#view
question_index GET /question(.:format) question#index
POST /question(.:format) question#create
new_question GET /question/new(.:format) question#new
edit_question GET /question/:id/edit(.:format) question#edit
question GET /question/:id(.:format) question#show
PATCH /question/:id(.:format) question#update
PUT /question/:id(.:format) question#update
DELETE /question/:id(.:format) question#destroy
question_create GET /question/create(.:format) question#create
question_view GET /question/view(.:format) question#view
def destroy
@question = Question.find(params[:id])
@question.destroy
redirect_to root_path
end
<%= link_to "Destroy", question_path(question), :method => :delete, data: { confirm: 'Are you sure?' } %>
Answer the question
In order to leave comments, you need to log in
The method is substituted using javascript
It must be enabled and the following files must be included in your manifest
#= require jquery
#= require jquery_ujs
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question