OJ is not as safe as you think for your JSON ruby

OJ is not as safe as you think for your JSON

OJ speeds up JSON in Ruby, but Oj.mimic_JSON silently drops the script_safe option, opening the door to XSS, and adds time precision quirks. What its monkey patching really changes, the stability risks, and best practices for using OJ without surprises.

Feb 3, 2025

How to work with JSONB column in pure Ruby on Rails ruby

How to work with JSONB column in pure Ruby on Rails

JSONB columns in Ruby on Rails without extra gems: use store_accessor to read and write keys like normal attributes, set sensible defaults, and validate required keys with a small module. Practical code you can drop into a PostgreSQL-backed Rails app.

Dec 25, 2023