News for hackers. Stuff that matters.
Re:Modern Front-end in Rails by pducks32 on Friday December 08, 2017 @10:51AM (#15879498)
Rails is still a truly incredible framework and it still moving very fast in terms of development. It’s front end stuff has always felt wrong to me and many others and we found weird ways to doing what we wanted. Rails 5 added support for a lot of them as the article points out but it still feels complicated.

Rails is awesome bc it’s opinionated but the fact that it’s ruby still lets you do what you want. I think rails needs to really dedicate some effort to better generators that ask which of these modern front end approaches do you want to use and then setup the project to just work and let me get to my coding.

Re:Modern Front-end in Rails by inopinatus on Friday December 08, 2017 @11:20AM (#15879750)
The webpack integration coming in Rails 5.2 starts to do exactly what you suggest. We’ve had the beta in general use for weeks and I’d say the framework is going in the direction you want.

This article seems a bit of overengineering by comparison and isn’t representative of what’s new out-of-the-box.

Re:Modern Front-end in Rails by coisnepe on Friday December 08, 2017 @02:27PM (#15881241)
Does 5.2 add anything on top of 5.1? The core team added the webpacker gem back in February this year but I haven't checked out yet what they're planning with 5.2.
Re:Modern Front-end in Rails by inopinatus on Friday December 08, 2017 @11:20PM (#15884268)
ActiveStorage for managing file uploads is the other big new feature.

There’s also a new secrets mechanism of dubious necessity. Seems DHH just can’t stop reinventing those.

Re:Modern Front-end in Rails by pqdbr on Friday December 08, 2017 @01:22PM (#15880678)
Totally agree. You can go the .js.erb views and `$('#div_id').replaceWith('<%= escape_javascript(render partial :partial_name) %>')` route, or you can use render_to_string and put your partial HTML in JSON and replace it with frontend JS, and so on and so on. And there's also turbolinks to consider and the idempotent stuff.

It's all great, I got my way around it, but I never know if what I'm doing is considered best practice or not.

Re:Modern Front-end in Rails by coisnepe on Friday December 08, 2017 @02:25PM (#15881224)
I don't understand from your comment whether you are aware that Rails 5.1 introduced generators to automatically add Vue, React and Angular (and Elm subsequently)? It sets everything up neatly and allows you to selectively incorporate reactive components where they're needed in your application, without having to go all the way to separating front and backend completely.

https://medium.com/statuscode/introducing-webpacker-7136d66c...