On Sep 22, 1:41 pm, dschruth <[EMAIL PROTECTED]> wrote:
> Lets just use your Magazine / Subscriber example for now.
>
> I want to do something like this:
> --------------------------------------------------------
> class Magazine
> def subscriber_salaries
> Subscriber.calculate(:sum, :salary, :conditions => "magazine_id =
> " + id.to_s) # PGError: ERROR: column "magazine_id" does not
> exist
> end
> end
You need to implement subscriber_salaries like this:
class Magazine
has_many :subscriptions
has_many :subscribers, :through => :subscriptions
def subscriber_salaries
subscribers.calculate(:sum, :salary)
end
end
-Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---