Joel Hawksley / / ←home

Conference proposal: Rethinking the View Layer with Components

This conference proposal was accepted for RailsConf 2019 and RubyConf Taiwan 2019. View slides


While most of Rails has evolved over time, the view layer hasn’t changed much. At GitHub, we are incorporating the lessons of the last decade into a new paradigm: components. This approach has enabled us to leverage traditional object-oriented techniques to test our views in isolation, avoid side-effects, refactor with confidence, and perhaps most importantly, make our views first-class citizens in Rails.


We’re going to talk about the shortcomings of the current Rails approach to views. We’ll then look at how React has introduced new ways of thinking about views. We’ll show how we’ve begun to incorporate these ideas into Rails, and how it might change the way Rails views look in the future.

The talk is based around the story of how we refactored an existing ERB template from the GitHub application into Ruby classes that function much like React components.

I will talk about how the original template:

And through the talk, I will refactor the partial into Ruby classes that:

I will then discuss how we’ve used this approach at GitHub and some of the performance implications.

This talk will fall on the intermediate level. It is a classic case of applying ideas from one technology (React) to another (Rails). It is a mix of both practical takeaways and a conjecture on the future of Rails.


I’ve worked on Rails apps of all shapes and sizes, but working on GitHub, a 10-year-old monolith with almost 4000 view files, has changed my perspective on the Rails view architecture. This talk will share this change in perspective in a way that is both interesting and practical, showing how we’ve applied this new way of thinking about views to one of the biggest Rails codebases in the world.