Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

link_to delete url is not working

Tags:

I have the following link_to delete url in my app

<%=link_to "Delete",blog_path(@blog.id), :method => :delete, :class => "delete", :confirm => "Are you sure ?"%>   

It does not seem to be working.When I click this url, it just takes me to the show path.Can someone please tell me how to fix this. Thanks.

like image 887
felix Avatar asked Dec 12 '10 18:12

felix


2 Answers

Make sure these lines appear in application.js :

 //= require jquery  //= require jquery_ujs 
like image 45
Matoeil Avatar answered Oct 05 '22 02:10

Matoeil


Are you using jQuery? If so, I think the problem could be that you are using jQuery without the updated rails.js file.

Download rails.js here: https://github.com/rails/jquery-ujs/raw/master/src/rails.js Drop it in your javascripts directory, overwriting the rails.js that comes default with rails.

Add a javascript include line to include it.

  <%= javascript_include_tag "rails" %> 

Put this after your Jquery include tag. You probably also want to disinclude the javascript defaults if you don't plan on using prototype.

I included jQuery UI in my application, I found that delete is now working as show, but after doing above Resolved Issue.

like image 176
Sean Ahrens Avatar answered Oct 05 '22 02:10

Sean Ahrens