Barry Frost

This is Barry Frost’s personal website.

Tagged #activerecord

Don't cache ActiveRecord objects

Better caching strategy to cache a query’s returned IDs. Also a smart way of detecting caching of AR objects in tests.


Real upsert for PostgreSQL 9.5+ and Rails 5+ / ActiveRecord 5+. Uses ON CONFLICT DO UPDATE.

Screencast: using ruby to add schema-less data to PostgreSQL

With hstore you can add schema-less data to PostgreSQL. This allows you to store model attributes without creating separate database columns. Watch how to do this using the activerecord-postgres-hstore gem.


Database sharding for activerecord (Ruby)

Automatic Reconnection of MySQL Connections in Active Record

Active Record since version 2.3 supports this reconnect option. Per default it’s set to false, but it can be enabled by adding reconnect = true to database options in database.yml.

That’s Not a Memory Leak, It’s Bloat

Detecting inefficiencies in Rails apps, in particular with ActiveRecord

Thinking Sphinx

Ruby gem to connect ActiveRecord to Sphinx

How to Localise ActiveRecord Errors in Rails

Master/Slave Databases with Ruby on Rails

Masochism: split reads and writes to two different databases

Agile Ajax: Using ActiveRecord to Migrate Legacy Data

How to Avoid Hanging Yourself with Rails

Useful tips on avoiding ActiveRecord magic creating inefficient queries

Bamboo Blog - Database Optimization for Rails Apps

Multiple Database Connections in Ruby on Rails (ActiveDelegate)

Enables master/slave replication arrangements - write to master; read from slave

acts_as_ferret - Ferret based full text search for any ActiveRecord model

Revolution On Rails: ActsAsReadonlyable

For forcing read-only in Rails - when using slave databases

Magic Multi-Connections

Connect to >1 database in your Rails app

Liverail » Rails with currents

Rails WebDAV plugin

Memcaching Rails

actsascached Rails plugin

Module: ActiveRecord::Acts::NestedSet::ClassMethods

Like a tree, but enables you to select the children and all of their descendents with a single query