Tuesday 06 July 2010

Deleting Old Ruby on Rails Active Record Sessions Using Whenever and Capistrano

If you’re using the Rails Active Record session store, you’ll notice that it does not delete old sessions. I’ve found this can quickly lead to sessions tables bloated with 100,000 records. I found a good solution on a blog for this, but it required some extra work to get this running with the whenever gem in my... More

Thursday 19 November 2009

Acts As Lockdown

A Rails plugin that addresses the need for certain ActiveRecord attributes to be unwritable when a record has entered a certain state. Take for example a product that begins in a "pending" state, and later enters a "published" state. From that point on, you require that the price and description must not be changed. The plugin assumes that you have a state machine in place that and your object will respond to a query on the state you specify eg self.published? It works... More