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
  })

Tags

You need to Login to tag this item.