On 16 Jan 2009, at 10:19, Herman wrote:

>
> Basically what I'm trying to do is get the sum of 2 columns and save
> those results in another. I guess I'm looking to do something like
> this:
> a = Product.find(:all)
> b = Product.sum("test + test2", :group => "id")
> a.test3 = b
> a.save
>
> Obviously that doesn't work, but I'm trying to achieve something like
> that. Any suggestions?
>
Product.update "test3 = test+test2" would probably do it.

Fred
> >


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to