The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From: Werner <webagentur.la...@googlemail.com>
Date: Fri, 26 Oct 2012 08:34:32 -0700 (PDT)
Local: Fri, Oct 26 2012 11:34 am
Subject: Re: [Rails] sum decimals
Thanks Rob.. true.. it works as expected.. Am Freitag, 26. Oktober 2012 16:53:13 UTC+2 schrieb Rob Biedenharn: > On Oct 26, 2012, at 8:18 AM, Werner wrote: > > I have a column "hours" which I want to sum up the decimals > > Week.sum('hour') => 22.5 > > But I want to "select by project_id" not the hole table. > > I cant find anything ...some help would be great. > You left the argument out of the .sum (i..e, .sum('hour') on the second > I think that you just need this: > Week.where(project_id: @project_id).sum('hour') > -Rob You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||