Ruby on Rails: ActionText Gets a Flexible Block Makeover
Today we're diving into a major ActionText enhancement that separates block content from editor values, plus some excellent testing improvements and community fixes. Jorge Manrubia leads the charge with a thoughtful redesign that makes ActionText more flexible for custom editor integrations, while contributors like Saidbek and Nicolas help clean up our test suite.
Duration: PT3M55S
Transcript
Hey there, Rails developers! Welcome back to another episode of the Ruby on Rails podcast. It's March 16th, and I'm excited to catch up with you about what's been happening in the Rails codebase. Grab your favorite beverage because we've got some really thoughtful changes to explore today.
Let's start with the star of today's show - a fantastic enhancement to ActionText from Jorge Manrubia. Now, if you've been working with ActionText's block functionality, you might have noticed something limiting: you could either use the value argument OR a block for your editor content, but not both. It was an either-or situation that could feel pretty restrictive.
Well, Jorge just changed all that with a really elegant solution. The new approach separates these concerns beautifully - your value flows into the editor's content binding, while blocks now render as actual DOM children of the editor element. Think of it this way: the value is what goes into your hidden input or editor content, while the block becomes the structure around it.
This might sound like a small change, but it opens up some exciting possibilities. You can now embed custom elements like prompt menus, toolbar extensions, or configuration elements right into your editor setup. It's especially powerful for folks building custom editors - like the Lexxy editor Jorge mentions - because you get the flexibility to inject child elements while keeping your rich text value completely separate.
And here's the really thoughtful part - Trix users don't need to worry about breaking changes. The TrixEditor maintains backward compatibility by capturing blocks as initial values when no value is present. It's that kind of careful API design that makes Rails so pleasant to work with.
Moving on to some excellent housekeeping, Saidbek contributed a really nice cleanup that simplifies ActiveRecord tests using NotificationAssertions helpers. I love these kinds of contributions because they show how Rails continues to eat its own dog food - using better testing patterns throughout the codebase. The changes touched instrumentation tests and async loading tests, making them more readable and consistent.
We also got a small but important fix from j01nb0k in the guides. They noticed that the `bin/jobs start` command in the Active Job Basics guide wasn't copying properly because of a missing dollar sign. It's one of those tiny details that can trip up developers following the documentation, and I really appreciate when folks take the time to fix these paper cuts.
Nicolas also strengthened our test coverage by adding tests for ActiveModel::Name's human method with the count argument. Testing might not be the most glamorous work, but these contributions help ensure Rails stays reliable as it grows and changes.
What I love about today's changes is how they show different ways to contribute to Rails. Jorge's ActionText enhancement required deep thinking about API design and backward compatibility. Saidbek improved internal code quality. J01nb0k made the documentation more user-friendly. And Nicolas strengthened our test foundation. Every single one of these contributions makes Rails better for all of us.
For today's focus, if you're working with ActionText, I'd encourage you to explore the new block functionality. Think about whether you have use cases where separating content from structure could make your editor setup more flexible. And if you're looking for ways to contribute to Rails, today's changes show great examples - whether it's improving documentation, strengthening tests, or tackling more complex feature work.
That's a wrap for today's episode! Remember, every line of code you write is part of your journey as a developer. Keep building, keep learning, and keep contributing to the amazing Rails ecosystem. I'll catch you in the next episode with more exciting updates from the Rails core team. Until then, happy coding!