Search code examples
ruby-on-railsherokuzurb-foundationturbolinks

dropdowns only trigger once


I have two filter dropdowns on this site which will only trigger the first time I press them. According to my studies it seems that it has to do with turbolinks, which I've disabled by adding data-no-turbolink to the body tag like so:

<body data-no-turbolink>
...
</body>

I've also tried adding this to all of the dropdown links and the link to open the dropdown.

<a href="some-link" data-no-turbolink>...</a>

It seems to work on development, but when I push to Heroku, it seems turbolinks are running again. Any suggestions?


Solution

  • If Turbolinks is an issue, it can be removed entirely from the project by following the instructions provided e.g. here:

    1. remove gem 'turbolinks' from the Gemfile and run bundle update
    2. remove //= require turbolinks from app/assets/javascripts/application.js
    3. remove "data-turbolinks-track" => true from the stylesheet and javascript tags in the header of application.html.erb layout file.

    Quoting Rails 4 In Action:

    ...it's our opinion that Turoblinks is great to speed up mostly-server-side sites, but as soon as you start writing some JavaScript, it causes more problems than it's worth.