I've been having trouble getting JQuery to work on my rails app. It affected me weeks ago with a drop down menu and now I can not call the delete method via a link.
<% if current_user.admin? && !current_user?(user) %>
| <%= link_to "delete", user, data: { confirm: "You sure?" }, method: :delete %>
Here is my application.js file :
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require_tree .
When I click the link delete, it sends me to the users profile when it's supposed to confirm delete, delete user, and then send me back to the user index. Also, when I switched "link_to" to "button_to" the delete method called correctly and the user was deleted and I was sent to user index and not users profile.
I've tried jquery not working in rails post, which I added script in the assets file and it did not work. Also tried various solutions from Rails 4 jQuery, javascript and coffee scripts not working and others that have not worked for me.
Let me know if anyone can help, thanks!
****Update ****
So, my application.js file actually had two other calls in it. Here is the full file ...
//= require serviceworker-companion
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker.js');
}
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require_tree .
Now, when I remove the if statement and the require service companion, or move them around in the file, I get a exception reentered error ... I am very confused.