I found out that my javascript code would not work when certain links where clicked.
When i set a breakpoint, the following js was not triggered after certain links
$(document).on('turbolinks:load', ready);
This is the link where js works
<%= link_to companies_path, method: :get, id: "Companies" do %>
This is the link where js does not work
<%= link_to "New Campaign", new_campaign_path, method: :get %>