Recently, I released a gem called ruby_ui_scaffold, a Rails scaffold generator designed for developers who want to build modern applications using Phlex and RubyUI from day one.
The idea behind it was simple:
Instead of relying on the traditional Rails scaffold that generates .erb templates, the goal was to create applications already structured around a Ruby component-based architecture powered by Phlex and RubyUI.
But shortly after releasing it, I realized an important question remained unanswered.
What about existing Rails applications?
The challenge of legacy applications
ruby_ui_scaffold works extremely well for new projects.
It allows developers to generate complete CRUD interfaces with controllers, forms, tables, and UI components entirely built with Phlex and RubyUI.
But the reality is that a huge part of the Rails community works on existing applications.
Applications that have evolved for years and contain hundreds of files like these:
app/views/products/index.html.erb
app/views/users/show.html.erb
app/views/orders/_form.html.erb
And naturally, this leads to an important question:
How do you migrate an existing Rails application to Phlex + RubyUI without manually rewriting the entire view layer?
That question led me to build the next step in this journey.
Introducing ruby_ui_converter
If ruby_ui_scaffold was created to help developers build new Rails applications using a modern stack, ruby_ui_converter is its natural continuation.
The goal is simple:
Allow existing Rails applications to gradually migrate their .erb templates into Phlex and RubyUI components.
In other words:
-
ruby_ui_scaffold→ helps build new applications with the modern stack from the beginning -
ruby_ui_converter→ helps existing applications transition to that stack
Automatically converting ERB into Ruby components
The gem recursively scans Rails view folders and automatically converts .erb templates into Ruby component files.
Example:
bundle exec ruby_ui_converter convert app/views/users
Output:
app/views/users/index.html.erb → app/views/users/index.rb
app/views/users/_user.html.erb → app/views/users/user.rb
The entire idea is to eliminate the repetitive work that usually comes with large migrations.
Intelligent conversion for Phlex and RubyUI
The goal was never to simply transform HTML into Ruby syntax.
The gem understands common Rails patterns and generates code compatible with both Phlex and RubyUI.
For example:
A traditional Rails template:
<%= link_to "Dashboard", dashboard_path %>
gets automatically converted into:
Link(href: dashboard_path) { "Dashboard" }
Partials like:
<%= render "form", product: @product %>
become Ruby components:
render Views::Products::Form.new(product: @product)
It also understands more complex structures like:
form_withcollection_select- checkboxes
- conditionals (
if,unless) - loops (
each) - Rails helpers (
dom_id,button_to,content_for)
and converts them automatically.
Gradual migration without rewriting everything
This was one of the most important requirements during development.
The gem does not modify the original ERB files.
Instead, it generates Ruby files alongside them.
This makes incremental migration possible:
- convert one folder at a time
- review generated code
- test each screen individually
- keep parts of the application running on ERB
There is no need for a risky “big bang” migration.
Building an ecosystem around RubyUI
My goal with these gems has never been to release isolated tools.
The bigger idea is to create tools that make adopting Phlex and RubyUI easier inside the Rails ecosystem.
Right now, that journey starts with two complementary pieces.
ruby_ui_scaffold
Built for new projects.
Generate complete CRUD applications using Phlex + RubyUI from the very beginning.
ruby_ui_converter
Built for existing applications.
Help legacy Rails apps migrate traditional ERB views into Ruby components.
The bigger vision
I’ve been spending a lot of time exploring ways to bring a more modern frontend development experience into Rails applications without losing what I have always loved about the Ruby ecosystem.
Writing simple code.
Maintaining high productivity.
Continuing to work primarily in Ruby.
These gems are part of that vision.
I believe that over the next few years, we’ll see more Rails applications adopting component-based architectures, and I want to help make that transition easier.
If you work with Rails and are curious about exploring the world of Phlex and RubyUI, I hope these tools can help you on that journey.
And this is only the beginning :)
Top comments (0)