ruby - Rails - delete method not working -


i trying delete entry specified in docs keep getting en error stating nomethoderror in tasks#show , entry not deleted.

index.html.erb:

<%= link_to 'delete', destroy_task_path(task['id']), data: { confirm: 'are sure?' } %> 

route.rb:

delete '/tasks/:id', to: 'tasks#destroy', as: 'destroy_task' resources :tasks root 'home#index' 

tasks_controller.rb

def destroy   uri = uri.parse("http://localhost/tasks/public/api/tasks/"+params[:id])   http = net::http.new(uri.host, uri.port)   request = net::http::delete.new(uri.path)   redirect_to :tasks, notice: 'task destroyed.' end 

what doing wrong here?! , why redirected show?!

you missed in link_tocall method: :delete, otherwise call.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo