Hacker News new | past | comments | ask | show | jobs | submit login

I never understood why rails has javascript helpers at all. It just does not bring any value in the long run, just complicates stuff. Rails should be js libraries agnostic and not provide any js related helpers out of the box in my opinion.

I'm one of the (formerly) silent, happy masses who uses the default stack gleefully. Turbolinks is amazing, ujs is wonderful, and coffeescript is adequate until all the latest JS goodness is out for real. Make it so only the first page load happens as an HTML request, everything after that happens via ajax for a couple lines more code sprinkled throughout, and I still get the regular html fallbacks? Yes please.

I'm able to quickly make entire complex interaction flows happen smoothly and maintainably on a single page. Now, there's a point, where when you have to start maintaining the state of various widgets on the page with each other, it gets pretty iffy and its helpful to bust out React. But even then, it's actually usually quicker to prototype out the templates/api for the widgets using vanilla Rails.

The javascript helpers that Rails have are wonderful because they let me quickly build useful software for people, and the fact that they're idiomatically consistent with the Rails request/response setup (is it an html response, or a js one?) throughout projects and apps cuts out a ton of cost of me or other developers (some who'd never even used it before!) dropping back into code I've written later to efficiently change things. Not, "what's being used here? What's the api for that? how is this set up?" etc etc.

I've found that, across many projects with many people, in the long run, these JS helpers are amazingly helpful and clarifying. So I'm going to have to firmly - but respectfully - disagree with your opinion that Rails shouldn't include them, simply because your opinion doesn't provide an alternative that gives me better benefits than what's currently there. It just strikes me as though it will divert engineering on actual hard problems of value to a lot more of simply engineering for engineering's sake. I'm not saying I won't change my mind...I'm saying, show me something better, and let's talk!

You have to look at in context; Rails got started in ~2006, long before you could do everything in JS, and its purpose was to enable you to build a web app from top to bottom.

At a glance, I don't think you can really claim that the JS frontend world is mature or stable, so in the meantime muddling-along seems equally valid.

data-method is probably the biggest reason why. When your biggest auth library (Devise) makes logging out, one of the most common actions you'll add to an app after signing in, a DELETE request, then having a quick one-attribute means to provide that link is very valuable to have.

Concurred. I'd previously only used Rails for building out APIs to be used in combination with libraries/frameworks like React and Ember.js. I'm recently working on a full-stack Rails app that has frequent usage of "remote: true" and some JS magic for things to work "the Rails way". The Rails JS "magic" is sort of confusing/horrifying when actually working with it and I'm finding it the cause of mysterious bugs that are hard to debug. :/ Why they just didn't use AJAX for these remote forms, I don't know. But it's annoying to deal with.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact