1

I saw two gems loaded in a Gemfile, so does it makes sense to load both of these gems or use only one?

gem 'jquery-turbolinks'
gem 'turbolinks'

Can anyone tell me why both of the gems are used?

2
  • did you find a solution to your problem? Commented Apr 14, 2014 at 16:30
  • 1
    jquery-turbolinks is deprecated, no longer recommended to use Commented Oct 21, 2020 at 19:59

1 Answer 1

1

As outlined here jquery-turbolinks gem fixes the bind event that is not always fired due to turbolinks firing ajax requests rather than usual page reloads.

If you have little javascript feel free to drop it but if you have some .bind(...) events that stop working, read the docs for the gem and you can probably use this to fix it, from the documentation:

But if you have a large codebase with lots of $(el).bind(...) Turbolinks will surprise you. Most part of your JavaScripts will stop working in usual way. It's because the nodes on which you bind events no longer exist.

I wrote jquery.turbolinks to solve this problem in my project. It's easy to use: just require it immediately after jquery.js. Your other scripts should be loaded after jquery.turbolinks.js, and turbolinks.js should be after your other scripts.

Sign up to request clarification or add additional context in comments.

1 Comment

jquery-turbolinks is deprecated, no longer recommended to use

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.