DEV Community

Jackson Pires for Vídeos de Ti

Posted on

🇺🇸 Learning RubyUI Through Real Applications with `ruby_ui_scaffold`

Building CRUD applications in Ruby on Rails has never been difficult. The challenge begins when we want to create modern, reusable, component-based interfaces without ending up with a mix of ERB templates, helpers, partials, and presentation logic spread across the application.

Over the past few years, tools like Phlex and RubyUI have introduced a compelling alternative for Rails developers who want a cleaner and more maintainable view layer. However, one challenge remains: getting started.

How should you structure your views? Which components should you use? How do you build complete CRUD flows with RubyUI?

To make that journey easier, I built ruby_ui_scaffold.

https://github.com/jacksonpires/ruby_ui_scaffold

RubyUI Scaffold

What is ruby_ui_scaffold?

ruby_ui_scaffold is a Rails scaffold generator that creates complete CRUD applications using:

  • Ruby on Rails
  • Phlex
  • RubyUI
  • Tailwind CSS

Instead of generating traditional ERB templates, it produces fully functional Phlex views built with RubyUI components from day one.

Think of it as a modern alternative to:

rails g scaffold
Enter fullscreen mode Exit fullscreen mode

but designed specifically for component-based Rails applications.

More than a Scaffold Generator

While the primary goal is to speed up CRUD development, ruby_ui_scaffold also serves as a practical learning tool.

Every generated resource includes real-world examples of RubyUI components such as:

  • Table
  • DataTable
  • Form
  • Input
  • Textarea
  • Checkbox
  • Badge
  • Select
  • Combobox
  • DropdownMenu
  • AlertDialog
  • DatePicker

Instead of reading documentation and trying to figure out how components fit together, you can study complete working implementations inside your own application.

Learning RubyUI Through Real Code

One of the biggest challenges when learning any component library is moving beyond isolated examples.

For example, generating:

bin/rails g ruby_ui_scaffold Buddy \
  name:string \
  email:string \
  admin:boolean \
  birthday:date
Enter fullscreen mode Exit fullscreen mode

automatically creates:

  • Forms
  • Index pages
  • Show pages
  • Create and update flows
  • Delete confirmations

All powered by RubyUI components.

This provides practical examples that developers can inspect, modify, and learn from immediately.

Exploring Relationships

The generator also supports belongs_to relationships out of the box.

For example:

bin/rails g ruby_ui_scaffold Book \
  title:string \
  author:references
Enter fullscreen mode Exit fullscreen mode

automatically generates:

  • Select inputs for small datasets
  • Searchable Comboboxes for larger datasets
  • Human-friendly relationship rendering
  • Eager loading to prevent N+1 queries

These generated examples demonstrate how advanced RubyUI components can be used in real applications.

Discovering the DataTable Component

Developers looking to explore more advanced UI patterns can enable:

--datatable
Enter fullscreen mode Exit fullscreen mode

This generates fully featured tables with:

  • Search
  • Sorting
  • Pagination
  • Per-page controls

All built around RubyUI's DataTable component.

For many developers, this becomes one of the easiest ways to understand how to integrate advanced RubyUI features into production applications.

Generate Data and Experiment

The included seed command makes experimentation easy:

bin/rails ruby_ui_scaffold:seed Buddy --count 100
Enter fullscreen mode Exit fullscreen mode

Using Faker, the generator populates your database with realistic sample data.

This allows you to test:

  • Tables
  • Forms
  • Search experiences
  • Pagination
  • Selection components

under realistic conditions.

A Playground for Phlex and RubyUI

Although ruby_ui_scaffold is highly productive, I believe its greatest value lies in education.

Every generated scaffold becomes a living collection of RubyUI examples that developers can inspect and learn from.

Rather than starting from a blank page, developers start from a complete application and gradually understand how RubyUI and Phlex work together.

For teams evaluating RubyUI, this can dramatically shorten the learning curve.

Conclusion

ruby_ui_scaffold was not created to replace learning RubyUI.

It was created to make that learning process easier.

By generating real code for real scenarios using real components, the gem helps bridge the gap between documentation and practical application.

If your goal is to accelerate CRUD development, ruby_ui_scaffold can help.

If your goal is to learn RubyUI and Phlex through hands-on examples, it may be one of the fastest ways to get started.

Top comments (0)