Hotwiring Rails - September 2022

#6・
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 - September 2022
By David Colby • Issue #6 • View online
Hi folks! This month we’ve got a deep dive into Heroku configuration, a really interesting look at a use case for the Rails Attributes API, a new project from Nate Hopkins, plus more excellent Rails-land content and a big announcement from me about my book.

Articles and guides
Making sense of Rails assets by Brad Gessler
If you haven’t been keeping up with the churn in the Rails asset options over the last year, getting started with a new Rails 7 project can be daunting. This article from the team at Fly.io is a nice overview of the various options that are available now along with a brief summary of how we get here.
As a side note, it is exciting to see the team at Fly investing in building a stronger Rails story. Fly is a very solid option for hosting Rails applications, and investment from their team in the Rails community is a great sign.
Stateless forms with the Rails Attributes API by Justin Searls
It can be hard to find in-depth looks at more advanced or obscure topics in Rails. In this article, Justin dives into a solution for building stateless forms with the Rails attributes API.
The article starts off with a clearly defined problem, steps through some potential, not-quite-right solutions, and then dives into an in-depth look at solving the problem with the attributes API.
Rails Reviews #1 — Preview component by Julian Rubisch
Julian recently started a new project, building a Rails code review service powered by (of course) a reactive Rails application. Along the way, he is sharing video snippets of how it is built.
In the first video in the series, follow along as he uses Turbo and CableReady to build a markdown-enabled commenting system that retrieves content from the server in real-time with CableReady::Updatable.
Thinking in Hotwire: Progressive Enhancement by Matt Swanson
This article from Matt Swanson offers progressive enhancement as a strategy to decide how much Hotwire to incorporate into your Rails application. This one isn’t a how-to, there’s no code to read. Instead, Matt clearly steps through each layer of the Hotwire stack, beginning with a standard Rails scaffold and discussing what each additional piece of Turbo adds to the puzzle.
If you are struggling with how to conceptualize the value that Turbo and Stimulus can bring to your application, this is a great starting point.
Taking off the Heroku train wheels: the Rails preflight checklist by Vladimir Dementyev and Travis Turner
Last month, Heroku announced the end to free tiers, which is a sad day for Rails devs who have used Heroku to get MVPs out into the world for over a decade. Despite the end of free tiers, Heroku is still a great option for small teams that don’t have the time or expertise to devote to managing everything themselves.
If you are getting started with Heroku and want to set yourself up for success, this VERY detailed guide from Evil Martins is an excellent resource. Even after a decade of deploying personal apps to Heroku, I learned a few things from this article.
Calendar component with ViewComponent and Hotwire by Andrew Foster
Wrapping up this month’s articles is a practical how-to guide to building an interactive calendar component with Tailwind, Turbo, Stimulus, and ViewComponent.
If you need to use the TailwindUI calendar component with a date input in an application, this article will get you to exactly that point. Note that this article assumes that you are already comfortable with Stimulus and Turbo Frames — if you aren’t, you should expect to do some experimenting to figure out how everything ties together.
New and interesting Rails-land PRs and releases
Nate Hopkins, the creator of StimulusReflex and CableReady, released a new gem, turbo_ready, that gives Turbo Stream users the ability to “take full control of the DOM with Turbo Streams”. As Nate notes, this is an extremely sharp tool, be safe out there.
Similarly, Marco Roth’s new turbo_power extend Turbo Streams to add CableReady’s DOM operations. This project is very much an early WIP and relies on unmerged PRs against turbo-rails. Both of these projects are cool extensions of Turbo, adding more power and filling in the gaps that (intentionally) exist in Turbo Streams.
I would treat both of these projects as interesting ideas and experiments with what a more comprehensive Turbo project could be in the future. I still think you should reach for CableReady for your production app needs for now.
Recent articles from my blog
Instead of articles from my blog this month, I’m excited to share that the book I published earlier this year is now free for everyone.
I am proud of what I created, and still shocked by the positive response the book received. When I started writing I hoped to sell at least one copy. I ended up selling far more than I imagined.
About 7 months after publishing, I have accomplished everything I set out to with this book, and with a recent change in life situation (starting a new full-time job that will take up much of my mental energy in the coming months), I decided to open the book up to everyone.
This project has been a tremendous highlight of my professional career and I am grateful to all of you who purchased the book for the support and encouragement of my work.
The book walks through building a real, complex Rails 7 application with a healthy mix of Turbo, Stimulus, CableReady, and StimulusReflex, and should be a great introduction to how these tools can work together to create a powerful, server-powered application with Rails. While I may not publish future updates, the book is currently up to date and should remain useful well into the future.
The best thing(s) I've read recently
Sorry for the non-programming content here, but I am just wrapping up reading The Outlaw Ocean by Ian Urbina, a gripping investigative work about life and work on the open ocean. It is full of terrifying and powerful stories and well worth a read if you want to read something that isn’t about writing Rails code.
Until next time
Andy Croll’s First Ruby Friend project is very cool, and the initial interest has been strong. If you are looking for a mentor in the Ruby community, or want to find a mentee to build your mentoring skills as a senior dev, take a look at what Andy is building.
I will be at Rails SaaS next month in Los Angeles. If you’ll be there too, please say hello!
As always, if you enjoyed this newsletter, send me a note and let me know or share it with a friend who might enjoy it too.
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