Ruby Video
Talks
Speakers
Events
Topics
Leaderboard
Sign in
Talks
Speakers
Events
Topics
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
by Daniel Schierbeck While most parts of Rails have been thoroughly overhauled during the past few years, one part has stubbornly refused improvement. The view layer is still by default using ERB to transform your app’s objects into HTML. While trying to solve a seemingly unrelated problem we discovered a design that suddenly enabled us to move past the limitations of ERB while still integrating closely with Rails. We could now separate presentation logic from display structure; reason about our views and how they relate; and dramatically improve our code. We called the library Curly, and it's pretty awesome.
Date
Summary
Markdown supported
In the video "Curly — Rethinking the View Layer" presented by Daniel Schierbeck at RailsConf 2015, the discussion centers around the limitations of traditional ERB templating in Rails and introduces Curly, an open-source project designed to enhance the view layer of Rails applications. Curly aims to separate presentation logic from display structure, allowing for easier customization and maintenance of views. **Key Points Discussed:** - **Background and Motivation:** - The speaker shares the struggles of customizing the ERP views while working on the second version of the Zendesk Help Center, which faced limitations due to its rigid structure and dependence on JavaScript for customization. - **The Challenges with ERB:** - ERB was found to be cumbersome when dealing with client customizations, leading to stagnation in updates due to unpredictability in breaking changes. - **Decision-Making Process for a New Template Language:** - Acknowledgment of prior failures when trying to allow customers to directly edit templates written in ERB. Need for a simpler, safe, and declarative approach motivated the creation of Curly. - **Key Features of Curly:** - Inspired by Mustache, but specifically designed for Rails, Curly allows HTML and templates to be separated from logic by keeping all logic in presenters, thus enhancing the maintainability and readability of code. - Customers can customize their templates while using predefined components, which can be manipulated without breaking what's already in place. - **Benefits of Curly Over ERB and Other Templating Languages:** - Presents a declarative syntax with defined structure and logic separation, enhancing both backend and frontend development experience. - Enables better testing practices by focusing on view logic rather than full rendering, making unit tests simpler and more effective. - Improves caching mechanisms by allowing easy integration of cache keys in presenters, leading to better performance. - **Use Cases and Adoption:** - Curly can coexist with existing ERB and HAML templates, gradually integrating into existing Rails applications with minimal changes. - Real-world success stories demonstrate its utility, as Curly has been in production for over two years. - **Concluding Thoughts:** - While Curly greatly enhances the view layer, there are still scenarios where standard ERB may be more appropriate for simpler templates. Overall, Curly has been celebrated for providing a better development experience, improving the separation of concerns in Rails applications, and facilitating easier customization for users and developers alike.
Suggest modifications
Cancel