Rapid Data Modeling Using ActiveRecord and the JSON Data Type
summary
Uses Postgres JSON/JSONB and ActiveRecord::Store to put varying attributes into a single data column, exposes them with store_accessor and custom typecasting so form helpers and ransack queries work, and composes reusable embeddable value objects inside the document. Builds an archaeology search and an accessibility assessment site, extracts equals queries fast with Postgres JSONB with GIN index but sees greater-than/less-than and nested-key queries slow (5–60x). Extracts the pattern into a docstore gem that ships and is used.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 1:49Rapid Data Modeling
- 4:15Project Introduction
- 5:29Archaeology
- 7:36Cataloging
- 8:48Things
- 9:44Attributes
- 10:17Object Registry
- 12:14Jason Column
- 15:38Ransack
- 17:25Document Store
- 17:59Hybrid Schema
- 18:21Rapid Data Modelling
- 21:50Inclusive Recreation Resource Center
- 28:41Nested Attributes
- 34:48Disadvantages
- 39:40Wrapup
related talks
14mJSON data structure – the hidden gem inside your database engine
46mUse PostgreSQL, not Rails, to make Rails Faster!
25mJSON in PostgreSQL - evil data type or just needs to be tamed?
33mSchemaless SQL The Best of Both Worlds
49mShould I use JSON in PostgreSQL?
48mPostgres and Json - How to get the best of them?
50mUsing JSON with Postgres 9 3
35mLeveraging PostgreSQL 17's JSONB for Enhanced Data Modeling
