⚡️ Hotwire dev newsletter - November 2022 edition

Turbo (Native), Stimulus, and Strada articles, code, courses, and more. Plus exclusive insights into how I build Turbo Native apps. Delivered monthly.

Welcome back to the November edition of the ⚡️ Hotwire dev newsletter!

This month the Rails Foundation was announced, an exciting new API was added to Stimulus, we learn that vanilla Rails is “plenty”, and more. There’s even a Turbo Native article that wasn’t written by me!

Speaking of Turbo Native, I’m putting the finishing touches on the curriculum and content for my first ever Turbo Native workshop. I’m hosting 15 people next month for a 3-hour deep dive into the framework and how to apply it to their Rails apps. If all goes well I will be running this more regularly in the future. Drop your email here to get notified when the second session goes on sale.

In more meta news, this month’s edition includes fewer articles but more editorial notes from me. Do you prefer more of my thoughts or more links? Hit the Reply button and let me know – replies go directly to my personal inbox.

📰 News

The Rails Foundation kicks off with one million dollars

Earlier this month The Rails Foundation was announced. Its mission is to “improve the documentation, education, marketing, and events in our ecosystem to the benefit of all new and existing Rails developers.” The eight founding core members together endowed a whopping $1,000,000 in seed funding to kick it off.

I’m excited to see resources being officially (and publicly!) allocated to where Rails can use the most help: education and marketing. And I’m doubly excited that “new Rails developers” are explicitly called out. But I also worry if we are putting even more responsibility and ownership in a few hands. It’s no secret that the big names in the Rails ecosystem have significant sway in which features make it into the framework.

Stimulus gets an Outlets API

by Marco Roth @marcoroth_

The Outlets API lets you reference Stimulus Controller instances and their controller element from within another Stimulus Controller by using CSS selectors. The use of Outlets helps with cross-controller communication and coordination as an alternative to dispatching custom events on controller elements.

When I saw Marco tweet this I let out an audible “YES!” I’ve used getControllerForElementAndIdentifier() too many times and it has always felt so hacky. Good riddance! I can’t wait for a new release to get cut so I can start integrating this into my projects.

📝 Articles

RubyConf 2022 is in a few days! This guide summarizes some advice from a few of the Scholars and Guides from recent RailsConf and RubyConf events. It’s a great place to learn what to expect and what to prepare for if this is your first Ruby conference.

My favorite part of conferences is the “hallway track”. Or, everything that isn’t an official talk. It’s meeting people for a coffee during downtime, chatting with someone as you wait for the next talk to begin, or grabbing dinner with a new friend. And if that sounds intimidating then tell a speaker you loved their talk. It’s a low-stakes way to connect with someone, especially because they want to hear from the audience.

Vanilla Rails is plenty

by Jorge Manrubia @jorgemanru

Brace yourself for this one. It’s not a breezy article. Jorge, a programmer at 37signals, challenges the common critique that Rails encourages a poor separation of concerns. He highlights different examples with big chunks of real code from HEY and Basecamp.

My biggest takeaway is the section on rich domain models. He encourages a broad surface area that covers all of the features and concepts associated with the model. But the actual work is done somewhere else. This creates a public API that covers the stuff it does but the actual implementation is squirreled away somewhere else. He uses a Rails concern plus a PORO in his example.

Moving Beyond, Not Getting Over, Imposter Syndrome

by Stephanie Minn

This article really resonated with me this month. As I was putting together the curriculum for my workshop I couldn’t help but think: What if no one buys this? What if everyone thinks its crap and requests a refund?

I didn’t share these feelings publicly. At first out of embarrassment. But then out of fear that it would lead to folks thinking the workshop wasn’t worth their time and money. Stephanie says, “I’m tired of feeling bad about feeling bad.” This is a new endeavor for me. It’s scary! And it’s OK to feel nervous or uneasy that it won’t be perfect.

I share my story not for your sympathy. But so the next time a coworker or friend goes through “imposter syndrome” you can empathize with them. You can help them use their emotions as a guide and separate what’s in their control vs. what isn’t. And most importantly, never assume or apply implicit biases. Because you never know the full story.

👩‍🎓 Tutorials

Turbo Native - How to Access Native iOS features with the JavaScript bridge

by William Kennedy @_williamkennedy

What’s this? Another Turbo Native article on the web? Yes, please!

This article covers one of my favorite parts of Turbo Native: dropping down into Swift and using Apple’s native SDKs. The example covers sharing data from the Contacts app via JavaScript messages.

The JavaScript bridge enables communication between the Turbo Native iOS/Android apps and Rails apps outside of the request cycle. This enables all sorts of unique experiences because you get full access to the underlying SDKs. If you can write it in Swift then you can expose it to your Rails app!

Build a Table Editor with Trix and Turbo Frames in Rails

by Julian Rubisch @julian_rubisch

One of the most exciting things about the Trix editor is how customizable it is. I’ve always been excited (and intimidated!) to add a custom toolbar button of my own. At my last job we added a few simple formatting options - highlighted text and such. But the implementation only scratched the surface of what Trix has to offer.

Julian takes this to another level by building a table editor directly into Trix. Scroll through the article to view the videos before you give it a read. This is impressive stuff! But there are a few workarounds required to get Trix to pay nicely with Turbo. I encourage you to read the last two paragraphs of the article before you decide to implement this on your own.

An Intro to dry-schema in Ruby

by Abiodun Olowode @AbiodunAjibade3

I’ve seen the dry-rb gems floating around for a while now but haven’t taken the time to really learn about them. So I’m excited to read up a bit on one part of the family, dry-schema.

It’s like ActiveModel::Validations on steroids. You can set up all sorts of elaborate rules to validate things. And once you build up a set of validations you can share them between models, kind of like a concern. What’s most compelling to me is that the validations aren’t limited to Active Record objects – you can apply them across your app, including URL params, JSON/YAML documents, configuration, and more.

Turbo Streams meets Action Cable

by Ayush Newatia @ayushn21

I’ve been thinking about adding real-time messaging to RailsDevs for a while now. But it always feels like too much work. Confession time… I’ve never used Action Cable. 🫢

So Ayush’s article couldn’t have come at a more perfect time! After only reading the overview section I already feel like I’m prepared to start integrating live updates to my app. “It packs in immense power with relatively little code.” – I couldn’t agree more.

🛍️ Black Friday deals

Black Friday deal season is starting! Here are some links to Ruby/Rails deals I’ve started to see pop up. Note that some of these are affiliate links.

👀 One more thing…

I’m kicking off a new initiative: an official RailsDevs referral program. Send me an email or DM if you want to be one of the first involved! You’ll get a revenue share for each paying business you refer - including a cut of any hiring fees.

Thanks,
Joe Masilotti
@joemasilotti joe@masilotti.com