# New plugin: Flagger

**URL:** <https://www.ruby-forum.com/t/new-plugin-flagger/88323>\
**Category:** Rails\
**Created:** [March 9, 2007, 6:06pm UTC](https://www.ruby-forum.com/t/new-plugin-flagger/88323 "2007-03-09T18:06:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 9, 2007, 6:06pm UTC](https://www.ruby-forum.com/t/new-plugin-flagger/88323/1 "2007-03-09T18:06:10Z")

</div>

Hi all,

I’ve just put out a plugin for ActiveRecord that stops you having to  
write repetitive bundles of methods such as

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

It gives you dynamic attribute-based methods similar to these. You can  
use certain negative prefixes to look for false values - Order.unpaid  
returns orders where paid is false - and chain attributes together, as  
in Order.paid\_and\_delivered, Cocktail.shaken\_but\_not\_stirred, etc.  
More info here:

[http://blog.jcoglan.com/flagger/](http://blog.jcoglan.com/flagger/)

I’d really appreciate a few people kicking its tyres in anything other  
than MySQL, or in Rails versions 1.0.x (is anyone still using those).  
Comments/bugs/test reports are always welcome.
