Building an ORM with AReL: Walking up the (AS)Tree.
summary
Builds a working tiny ORM called storm on top of ARel, using the pg gem and a Postgres visitor to generate SQL; implements schema caching, Column->Type mapping (string/integer plus a generic fallback), attribute sets with reader/writer singleton methods, and ARel insert/update/delete managers to perform create, find, update, destroy and count. The result is a complete CRUD engine in ~560 lines of code that runs against PostgreSQL and passes the demo tests.
AI-written summary · about
chapters (8)
- 0:00Introduction and context
- 2:51Understanding ORMs
- 5:43Core architecture and setup
- 9:42Database connections and schema
- 14:00Setting up tests
- 16:42Attributes and typecasting
- 21:00Readers and writers
- 23:36CRUD operations and conclusion
related talks
25mActiveRecord can't do it? Arel can!
32mArel: The Ruby Relational Algebra Library
35mAdvanced aRel: When ActiveRecord Just Isn't Enough
05mHow to use Arel? Wrong answers only!
21mActiveRecord can't do it? Arel can!
27mRediscovering ActiveRecord
28mActive Record Scopes and Arel
17mWrangle Your SQL With Arel
