December 2009
1 post
record_filter adds column comparisons across...
I just released version 0.9.14 of record_filter with a spiffy new feature that allows you to compare columns across tables instead of simply comparing columns against your data. Let’s say you have a Blog class that has_many Posts and you want to only get the articles that were created since the last time their publication was updated. Now you can do this:
Blog.filter do
having(:posts)
...
November 2009
1 post
Setting up Kerberos on Snow Leopard
For some inexplicable reason, the Kerberos tools have been pretty much completely removed in Snow Leopard, in favor of a simple “Ticket Viewer” app that manages tickets but doesn’t help at all with the Kerberos setup. If you don’t have an existing kerberos setup, your only option in the ticket viewer will be “Add Identity” and it will give you this excellent...
June 2009
1 post
RecordFilter turns 0.9.8
Record Filter, everybody’s favorite ruby library for specifying queries in ActiveRecord, has just hit version 0.9.8. This version has some handy improvements for doing distinct queries and aliasing tables in joins, but it in some cases it is not backwards compatible with previous versions. If you are using an earlier version, take note of the breaking changes described here.
Distinct
...
May 2009
7 posts
Ruby 1.8 funkyness with Class.new and inherited
I just found a bug in Sinatra where this code will fail with the error “can’t dup NilClass”:
Class.new(Sinatra::Base) do
get('/') { 'abc' }
end
Sinatra uses the ‘inherited’ method to initialize a number of class variables in new subclasses of Sinatra::Base when they are defined. For normal subclassing, this works great because ‘inherited’ is called...
Simple Rails performance analysis
Working on fixing performance problems in our rails app, I often find myself interested in simple performance metrics, like the number of queries that are performed, the slowest partials, and the slowest queries. These things are all there in both the output from script/server and the rails log, so it seems that a lightweight tool ought to be all that’s required to see what’s going on. I recently...
ActiveRecord observers in gems/plugins
I’ve recently been working on a caching tool for Rails that has a declarative API for invalidating caches when objects of specific types are changed. The idea is that we should be able to tell the caching system that specific types of caches are automatically invalidated for a given type:
cache_config.article_cache :expiration_types => [ :article ]
This requires that the gem be able to set...