May 2022 edition

⚡️ Hotwire dev newsletter

Turbo (Native), Stimulus, and Strada news and code. Subscribe to the Hotwire dev newsletter.

By subscribing, you agree with Revue’s Terms of Service and Privacy Policy.

My first RailsConf is officially over. 😢

But I had an amazing time meeting folks IRL for the first time! If we didn’t get to say hi then let me know and I’ll make sure we meet at the next conference.

All told, I learned a lot. My favorite technical talk was from Dave Copeland on why your app needs a service layer. Not necessarily service objects, but a spot where all of your business logic lives.

I took this to heart and have been slowly refactoring the railsdevs codebase to extract a service layer. I’m not 100% sure this will get merged in, but it is definitely fun to experiment with a new approach.

I know the word “service” gets a bad rep in the Rails world. But I think it’s worth exploring a new way to organize code every now and then.

Does your app have a service layer? Are you all in on a DSL/framework to help facilitate that? Or do you throw everything in Active Record models?

Email or DM me on Twitter with your thoughts – I’d love to hear your take!

Help us scale the next generation of fantasy sports and betting Underdog Fantasy is looking for a Backend Rails Engineer to help scale and grow our profitable business. Our pragmatic infrastructure is a Rails 6.1 monolith deployed as Rails Engines across API-powered microservices.

📹 Videos

Let’s recreate Notion in Ruby on Rails - Episodes 2 + 3

by Dr Nic @drnic

Following up on last month’s video, Dr. Nic published the next 2 parts of the tutorial on recreating Notion in Rails. These episodes cover inline editing and integrating Tip Tap for rich text editing.

Real-Time Page Updates With Hotwire in Just 5 Minutes

by Mix & Go

I’m really loving these 5 minute videos on Hotwire on the Mix & Go YouTube channel. This time we are walked through building a buddy list of sorts - a live-updating screen that shows who is currently online. Make sure to watch until the end as there is a gotcha for using this code in production.

🎓 Tutorials

Custom Turbo Stream Actions

by Roland Studer @RolandStuder

Turbo only provides 7 different Turbo Stream actions out of the box: append, prepend, replace, update, remove, before, and after. But what if you want your own custom action, like redirect? Roland walks us through how to create your own custom Turbo Stream action with a Stimulus controller and a good ol’ helper.

A Case for Query Objects in Rails

by Thiago Araújo Silva @thiagoaraujos

Query Objects have been top of mind for me since adding filtering to railsdevs. They help keep all query-related business logic in a single model without ballooning the scope of your Active Record models. Here, Thiago walks through some steps to make your Query Objects easier to write and understand.

Infinite scrolling pagination with Rails, Hotwire, and Turbo

by Yaroslav Shmarov @yarotheslav and Phil Hayton @gotbadger

Leveraging popular pagination framework Pagy, Yaroslav and Phil progressively enhance a long list of items with Hotwire. What starts out as a button to load more results eventually becomes an infinitely scrolling list. There’s also a bonus section on building your own pagination without a third-party library.

Dynamic "Like" button without JavaScript

by Guillaume @guillaumebriday

An entire tutorial all in a single Tweet-able image! What a flex from Turbo Streams that we can build something so dynamic without a single line of JavaScript.

🌏 Community

2022 Ruby on Rails Community Survey Results

by Planet Argon @planetargon

The survey results are in! Every year Planet Argon runs the Ruby on Rails Community survey and this year they received over 2,500 responses. As always, they compare results to previous surveys with nice graphs and charts. I’m still diving in to all the results but there is a lot to learn here.

💎 RailsConf 2022 slides

RailsConf 2022 was last week and a ton of amazing talks and workshops were given.

According to the organizers, video recordings will be available publicly later this year. Until then, here are links to the slides from various talks throughout the week.

By the way, this page will be updated as more folks share their slides. Send me an email to get yours listed, too!

🙋‍♂️ Some personal updates

I took a hiatus from client work this month to focus on my side businesses. And boy have I been busy!

I’d love to know what you think about this edition – please send me an email or DM me on Twitter. That’s all from me – see you next month!

Joe Masilotti

P.S. The Hotwire dev newsletter is accepting sponsorships and job postings! Email me if you're interested in reaching a dedicated group of Ruby on Rails developers.

Turbo (Native), Stimulus, and Strada news and code. Subscribe to the Hotwire dev newsletter.

By subscribing, you agree with Revue’s Terms of Service and Privacy Policy.