Created
May 30, 2010 00:00
-
-
Save sr3d/418648 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Budget < ActiveRecord::Base | |
belongs_to :event | |
belongs_to :category | |
scope :for_event, lambda {|event_id| where("event_id = ?", event_id ) }, | |
:select => '*, ( SELECT SUM(amount) FROM expenses WHERE event_id = budgets.event_id GROUP BY category_id ) AS total' | |
# the above code error out, wrong params, 3 for 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment