In my Rails application, I have the following code for a dropdown menu:
I have had this issue for the whole day but was finally able to fix it. I applied the solution above (changing the order) and the dropdown worked. However, I noticed in the console there were errors (Uncaught ReferenceError: jQuery is not defined) due to the fact that bootstrap-sprockets was called before jQuery. I have found a solution that worked for me here
Basically, I have included the following code below the required items in application.js as:
//= require jquery
//= require tether
//= require jquery_ujs
//= require bootstrap
//= require bootstrap-sprockets
//= require turbolinks
//= require_tree .
$(document).ready(function(){
$('.dropdown-toggle').dropdown();
});
For me this worked like a charm. Hope that helps somebody!