Flagger updated to 0.9.1

Flagger, my Rails plugin for handling boolean attributes in ActiveRecord, has been updated to version 0.9.1. This release fixes a problem whereby if an ActiveRecord model class defines constants with the same names as those used in Flagger, Flagger doesn’t work. Everything has been restructured to provide more sensible namespaces for the various bits, but functionally nothing has changed. See the project page for installation details.

This release also includes a patch for testing against the just-released Rails 1.2.3. Don’t say I don’t spoil you.

Flagger 0.9.0 released

I’ve just released a Rails plugin that simplifies dealing with boolean flags in ActiveRecord. It gives you a load of easy-to-read dynamic attribute-based finders and setter methods without you having to write a line of code. It’s perfect for eliminating the tedium that arises from defining things like this over and over again:

  class Order < ActiveRecord::Base
    def self.paid
      find_all_by_paid(true)
    end

    def self.unpaid
      find_all_by_paid(false)
    end

    def mark_as_paid
      update_attribute(:paid, true)
      # related tasks
    end

    def mark_as_unpaid
      update_attribute(:paid, false)
      # related tasks
    end
  end

There’s more information on the Flagger project page. Any feedback – comments, bugs, testing with obscure DBs – is very welcome.

This was never meant to happen…

It seems I’ve started blogging. Or at least, it seems I’ve created a blog for the purposes of talking about bits of code I’ve written. Don’t expect any pearls of geek wisdom just yet, though. I mostly started this thing to make announcements about code projects I feel like releasing publicly.

I submitted my first patch to Rails a couple days ago. The response was encouraging, but not encouraging enough to merit inclusion in the core. So, I’m packaging it up as a plugin and should be releasing it after it’s been more thoroughly tested.