I need to require both in my application.js file. The problem is if one is above another, parts of my application break. But I need both of them working.
E.G. If I require jquery over jquery_ujs, my log out functionality stops working and I receive a No route matches [DELETE] "/users/sign_out"
error.
E.G. Vice Versa, if jquery_ujs is over jquery, some links from devise such as 'destroy' or 'edit' completely disappear.
I believe this to be a problem with devise, but I am unsure what I should do.
Application.js:
//= require jquery_ujs
//= require jquery
//= require bootstrap
//= require turbolinks
//= require masonry/jquery.masonry
//= require_tree .
_header.html.erb:
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav navbar-right">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "About", about_path %></li>
<% if user_signed_in? %>
<li><%= link_to "New Pin", new_pin_path %></li>
<li><%= link_to "Account Settings", edit_user_registration_path %></li>
<li><%= link_to "Log out", destroy_user_session_path, method: :delete %></li>
<% else %>
<li><%= link_to "Sign in", new_user_session_path %></li>
<% end %>
</ul>
Update: Obviously, when I logout, it doesn't work and gives the error No route matches [DELETE] "/users/sign_out
. However, if I refresh the page I get a successful logout :/ everytime.