Hotwiring Rails - December 2021

#1・
652

subscribers

6

issues

Subscribe to our newsletter

By subscribing, you agree with Revue’s Terms of Service and Privacy Policy and understand that Hotwiring Rails will receive your email address.

Hotwiring Rails - December 2021
By David Colby • Issue #1 • View online
Hi folks - welcome to the December 2021 edition of Hotwiring Rails, now powered by Revue.
This month we’ve got a release candidate of Rails 7, a new Turbo release, a deep dive into Kuby, a look at an established company’s transition to Hotwire, and more.
Thoughts or feedback on how I can make this newsletter more valuable? Have something you’d like to include in next month’s edition? Just reply to this email, or find me on Twitter.
- David

Articles and guides
Rails, Hotwire, CableReady, and StimulusReflex are BFFs by Nate Hopkins
This article from the creator of CableReady and StimulusReflex offers perspective on how the different pieces of the modern Rails landscape fit together.
This one is full of useful links and thoughtfully lays out a key philosophical distinction between Turbo’s aggressive adherence to RESTful principles and SR’s embrace of flexibility.
Kubing Rails: stressless Kubernetes deployments with Kuby by Vladimir Dementyev and Travis Turner
If you (like me) have been intimidated by the complexity of Kubernetes, you might be interested in taking Kuby for a spin.
In this detailed tutorial on deploying a real Rails application with Kuby, the Evil Martians team gets down in the weeds and describes challenges they encountered and how they overcame them while deploying a Rails + AnyCable application to DigitalOcean with Kuby.
Why Hotwire in 2021 by Cédric Fabianski and Elizabeth Braae
The Bearer team talks about their transition from a complex React-powered frontend to a simplified, Hotwire-powered approach with a small team and a rapidly growing product.
If you’re considering whether your team can make the switch, I’ll leave this quote from the article here, click through to read the rest:
“We were essentially maintaining two applications where one should have been enough. The big learning was that this architecture might have made sense for large, stable applications, but it didn’t make sense for a company iterating fast to find a good product market fit.”
Building a Real-Time Chat App in Rails Using ActionCable and Turbo by Abiodun Ajibade
This implementation of the classic chat application demo relies on Turbo Streams to build a multi-room chat application, with a little bit of Stimulus in the mix. Turbo Stream model broadcasts keep things simple and clean — a nice introduction to the power of Turbo Streams and, more generally, the power that ActionCable unlocks for Rails libraries.
Rails Remote Elements Tutorial by Steve Polito
Steve takes us through an interesting approach to implementing a SPA with rails-ujs and Stimulus, showing us that the tools to build highly responsive user experiences in Rails have been available for years.
Leveraging Stimulus data attributes and built in rails-ujs events, we get a classic SPA todo application without React. An interesting experiment and learning experience, and a nice reminder of the power of rails-ujs, forgotten, but not gone.
A Rails Multi-Tenant Strategy That’s ~30 Lines and “Just Works” by Jason Meller
This quick read demonstrates a simple multi-tenant implementation without reliance on gems. Thoughtfully designed and battle tested in a large production application, this is a nice implementation of a common requirement for Rails-powered SaaS applications.
Included is a neat trick for setting Current in the Rails console, discussions of testing considerations, and a thoughtful acknowledgement of criticisms of Rails’ Current attributes implementation.
Rails 7, Railties, and Sorbet at Shopify with Rafael França from Rails Core by Remote Ruby
I’ll confess that I’m not much for listening to technical podcasts, but this conversation between the Remote Ruby team and Rafael França was very enjoyable.
Come for the (now confirmed) hint at the Rails 7 release timeline, stay for the thoughtful words from Rafael on Shopify’s development practices, types, and Hotwire
The CableReady Language Implementation Project
The StimulusReflex team has a vision to expand CableReady outside of the Rails world and into a “universal standard tool for developers to dynamically control browsers from the server”.
This is a big project, and they’re looking for help from developers capable of building server-side libraries in languages like Go, Python, and Java. If this sounds like you, give their call for support a review and get in touch with the team.
New and interesting Rails-land PRs and releases
Turbo
This is a huge release that includes changes that adds rails-ujs style functionality to Turbo and fixes for a number of outstanding bugs, a few of the highlights in this release for me:
  • Push state history on frame navigations — This is the most exciting addition in 7.1 in my opinion, making it trivial to update URLs on frame navigation. This change dramatically improves the usability of tabbed interfaces and search forms powered by Turbo Frames
  • Add requestSubmit polyfill — This small change eliminates the need to manually add the requestSubmit polyfill to projects using Turbo. If you’ve moved away from rails-ujs, you may have gotten bit by the lack of access to Rails.fire(‘submit’) like me. requestSubmit with this polyfill is a nice alternative
  • Add data-confirm behavior to Turbo — Another rails-ujs behavior cleanly migrated to Turbo. The implementation is slightly more verbose so that it doesn’t clash with existing rails-ujs behavior, just in case your project has Turbo alongside old rails-ujs code.
Rails
With this release, we’re on track to see Rails 7.0 out before the end of the year.
Since Alpha 2 in September, much of the work has been on bug fixes, deprecation, and documentation. One interesting new interface that made the cut was the addition of a standardized error reporting interface, via Rails.error that should simplify handling and reporting errors in Rails apps.
Recent articles from my blog
I won’t be publishing many brand new pieces for the next few months because I’m focused on finishing my modern Rails development book/course (~2/3 done with the code).
Before going heads down, I published this quick piece on my Rails + esbuild config for live reloads.
I’m also committed to keeping my turbo-rails documentation pieces up to date with new Turbo releases — Turbo Frames on Rails was updated after the release of Turbo 7.1.
Expect to see many more shorter form tutorials from me after I publish my Hotwiring Rails course in (fingers crossed) late January.
The best thing(s) I've read recently
The unreasonable effectiveness of simple HTML by Terence Eden — This newsletter, and all of my writing, is about modern web development. I’m interested in building highly interactive websites, which some times means using techniques absolutely will not work on Internet Explorer, much less on a PSP or a TV.
This piece from January of 2021 is a thoughtful reminder that, for many use cases, your users are best served with simple, old school websites that work, all the time, in every situation, with no fluff.
Exploring new things is fun, cool, and sometimes profitable, but if you’re building web sites for critical services, very broad audiences, or vulnerable populations, you probably don’t need that slick animation or cool new JavaScript tech.
The pragmatic engineer test: 12 questions on engineering culture by Gergely Orosz — Hiring Rails developers seems to get harder by the day and retaining your current team can be a challenge.
Building the right culture — and sharing that culture widely — can help you get a leg up. Gergely’s thoughtful overview of the questions you should be able to answer as a leader about your engineering team’s culture is a nice place to get started.
Bonus — Jamie Lawrence walks through how his team at Podia scores on these 12 questions.
Until next time
RailsConf
Mark your calendars folks, we're headed to Portland for #RailsConf2022 May 17 - 19 🎉🎉🎉 https://t.co/jO5pyriQhX
I’ll be there — I hope to see some of you there too!
That’s all for this month’s edition of Hotwiring Rails. For those of you who celebrate, happy holidays! I’ll be back in the new year.
Did you enjoy this issue?
David Colby

Hotwiring Rails is a once-monthly newsletter curating the latest content on Rails, Hotwire, and other things you might find interesting.

In order to unsubscribe, click here.
If you were forwarded this newsletter and you like it, you can subscribe here.
Powered by Revue
Colby Consulting, 13359 N Hwy 183 #406-1058, Austin, TX, 78750