Return Data, Not ActiveRecord Objects
Why returning plain data instead of models made some of my Rails code simpler, faster and easier to test.
Why returning plain data instead of models made some of my Rails code simpler, faster and easier to test.
Years ago I added Elasticsearch to a Rails app and search got faster. I credited the search engine. Looking back, I’m not sure that was the lesson. Here is h...
Rails 8 isn’t really a bag of new methods. Its headline is a stance: drop Redis, drop the PaaS, and run a real app from a single box you own — with the datab...
Service objects keep business logic out of fat controllers and models. A handful of conventions (one entry point, a consistent return value, a simple constru...
You don’t need a database table to get Rails-style validations. With ActiveModel you can validate plain Ruby objects (a contact form, a search form, an API p...
Before reaching for Elasticsearch, it’s worth knowing that PostgreSQL has capable full-text search built in. Here’s how to use it from a Rails app — tokenizi...
Rails 7.1 isn’t a headline release. It’s a pile of quality-of-life additions that quietly remove boilerplate you write all the time — normalizing attributes,...
Knowing how to use the Rails console can be very useful when debugging or trying your snippets. Being proficient with it will increase your productivity.
Following the mass and using de-facto libraries isn’t always the best choice. Here are some thoughts about handling translation of data stored in database wh...