Turbolinks
As already mentioned, the problem with Turbolinks is that it reloads the <body> DOM with an ajax call - this means that JS does not restart, as it is in the head
A typical way to solve this problem is to delegate your JS from document , for example:
$(document).on("click", "#your_element", function() {
Since document will always be present, it will run JS continuously
Remote
With your problem it's a little harder
The problem is that you rely on the JQuery UJS (unobtrusive JavaScript) Rails engine, which is hard to fix on your own
We have never had this problem, and we constantly use Turbolinks, so I assume that the problem may be how you create the form / process the request. This github seemed to recreate the problem, and this is related to the table
Perhaps you could try:
<%= form_for [object], remote: true do |f| %> <%= f.text_field :name, class: 'form-control' %> <%= f.email_field :email, class: 'form-control' %> <%= f.submit button_name, class: 'btn btn-sm btn-primary' %> <% end %>
source share