Curly — Rethinking the View Layer
summary
A Rails-friendly template engine called Curly templates extracts all view logic into plain Ruby presenter classes placed in app presenters, keeps HTML purely declarative, and lets customized templates live in the database while reusing the same presenter. Caching uses a simple cache_key method on presenters; testing calls presenter methods directly. It ships in production for about 2.5 years, stops Javascript-based DOM hacks, reduces breakage across tens of thousands of customers, and integrates with ERB/Haml rather than replacing them.
AI-written summary · about
chapters (17)
- 0:00Intro
- 0:42No JavaScript!
- 1:36Curly Rethinking the view layer
- 2:09How we came to build a new template language
- 2:42Help Center Hosted knowledge Base & Community that integrates with Zendesk
- 5:46Theming & customizable templates
- 8:21Customers should write templates, not code
- 15:24Customers' templates stored in the database
- 15:54Safe and simple for our customers to use
- 19:03Separation of structure & logic (!!)
- 20:48Render view with a bunch of variables set • Parse the result
- 22:36Test the logic with unit tests
- 24:12Use the best tool for the job Markup languages for structure Programming languages for logic
- 25:36Action Controller Rendered HTML Action View Ruby code (string) Template Handler
- 27:45So, is Curly better than ERb?
- 29:36Running in production for 2 years
- 29:49gem install curly-templates
related talks
32mWhere did the OO go? Views Should be Objects Too!
44m"The View Is Clear from Here"
34mThe Modern View Layer Rails Deserves: A Vision for 2025 and Beyond
54mThe View is Clear From Here
38mRethinking the View Layer with Components
40mBlow Up Your Views
48mPresenters and Decorators: A Code Tour
36mRails Vs. The Client Side
