# Models
Class InvoiceItem < ActiveRecord::Base
belongs_to :fee
end
Class Fee < ActiveRecord::Base
has_one :invoice_item
end
# Namedcope in Fee model
namedscope :uninvoiced, {
:conditions => "fees.id NOT IN (SELECT fee_id FROM invoice_items)"
}
Showing posts with label query. Show all posts
Showing posts with label query. Show all posts
Tuesday, May 4, 2010
Finding uninvoiced fees in rails
Subscribe to:
Posts (Atom)