Agile Web Development

Build it. Launch it. Love it.

Condition Builder

I use this directly in my ActiveRecord queries, like this:

Book.find(:all,
  :include => {:content_pointer => :invitees},
  :conditions => Condition.block { |c|
    c.and "invitees.user_id", self.id
    c.and "content_pointers.created_by_id", self.id
    c.and "content_pointers.company_id", company.id if company
  })

Vitals

Home http://blog.inquirylabs.com/2007/01/04/condition-builder-10-released/
Repository http://inquirylabs.com/downloads/condition-builder-1.0.tgz
License Rails' (MIT)
Tags Tag_red conditions filter queries sms where
Rating (6 votes)
Owner Duane Johnson
Created 4 January 2007

Comments

Add a comment