Form with remote: true not working with turbolinks

不羁的心 提交于 2019-12-08 15:18:31

So it seems disabling turbolinks on certain elements worked but it changed since Turbolinks 5 and i missed it on the turbolinks 5 documentation. For future reference

examples from documentation

<a href="/" data-turbolinks="false">Disabled</a>

<div data-turbolinks="false">
  <a href="/">Disabled</a>
</div>

Rails example

<%= link_to "Overview", inventory_index_path, :"data-turbolinks"=>"false" %>

I hope this helps but if anyone finds the real problem do let us all know!

Try loading all the js files in head instead of at the end of the body.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><%= content_for?(:title) ? yield(:title) : "app" %></title>
    <%= csrf_meta_tags %>
    <%= favicon_link_tag %>
    <%= stylesheet_link_tag "application", :media => "all" %>
    <%= javascript_include_tag "application" %>
  </head>
  <body>
    <%= render "layouts/application_header" %>
    <div class="container">
      <div class="row">
        <div class="col-lg-12">
          <%= yield %>
        </div>
      </div><!--/row--> 
  </body>
</html>

oy you will be having this same problem from now on.

and add the gem jquery turbolinks and follow the instructions there. https://github.com/kossnocorp/jquery.turbolinks then you can work again with document ready in your page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!