News for hackers. Stuff that matters.
Re:Drop jQuery as a dependency from Rails by arnvald on Wednesday June 01, 2016 @09:53AM (#11814323)
Rails is a full-stack framework. One of its strengths is that out of the box you have everything there - database integration, http layer, also JavaScript.

Having said that - you have a choice. Rails is about defaults. By default it gives you jQuery, CoffeeScript and TurboLinks, but you don't have to use it at all. I've built a number of Rails apps and most of them use CoffeeScript, but don't use TurboLinks. It took me just a few seconds to remove it from my Gemfile.

Also, Rails API project is a subset of Rails that does not require JS (it was merged to Rails so you'll be able to generate API application in Rails 5).

Re:Drop jQuery as a dependency from Rails by kendallpark on Wednesday June 01, 2016 @11:18AM (#11815031)
First thing I do when creating any Rails app is take out Turbolinks. It's like autopilot.
Re:Drop jQuery as a dependency from Rails by pbreit on Wednesday June 01, 2016 @02:58PM (#11817169)
Turbolinks seem really great for the user. What do you not like about them?
Re:Drop jQuery as a dependency from Rails by gobusto on Thursday June 02, 2016 @04:37AM (#11821121)
One problem I've run into is that the Javascript state isn't reset when Turbolinks pretend-reloads the page. This can lead to "interesting" bugs if setInterval() calls or websocket-rails response handlers hang around when you navigate away from the page that they "expect" to be run on.

Attempting to reproduce these errors by refreshing the current page and repeating whatever you just did will not work, since the Javascript state will be wiped clean - you'll need to navigate through the same path that you took to get to that page in the first place. (This happened to me recently; as you may imagine, it took me a while to figure out what was going on!)

It's possible to work around this by "cleaning up" whenever a Turbolinks change event fires, of course, but the point is that you can't just add Turbolinks to your project and expect everything to work as it did before.