The Lapidary Lemur

Musings from Brandon Weaver

You Type Too Much

You type too much. Whether it’s in the command line, your editor, repeating the same code patterns, or whatever else it all comes down to one thing: you type too much, and I’m here to help fix that.

The irony here is that this is a long article in which I most certainly type too much. This is far more an overview article than anything, and there will be followups detailing the covered sections at a later date.

Association Aggregates Explained

The last post covered some of the basics of aggregate commands, but left out a section explaining the more perilous aggregates of associations and more advanced querying against them.

Here are a few questions to get you thinking before we start. Given a model Foo which has_many Tags (key, value, foo_id):

  • How do we find the count of tags for every Foo?
  • How do we find a Foo with multiple matching tags? (name: ‘David Tennant’ AND color: ‘Blue’)

Suddenly ActiveRecord becomes very annoyingly complicated to use, but not to fear! We can still use SQL for all of this.

Aggregate Active Record

Active Record is an extremely powerful abstraction on SQL, but many a Rails programmer tends to forget that that means the entirety of the SQL standard. While it might be common knowledge for some, aggregate queries seem to be missing from the toolkit of a newer rails programmer.

The Clairvoyant Project

The Clairvoyant project is one of my more ambitious personal projects, with one “simple” goal in mind: Your tests should be able to generate your application code

This post will outline the beginnings of the madness that led to Clairvoyant as well as some of the details of how things are planned to be implemented.