add a hidden field with    []  in them it will make the params create an
array and put the ids of the paged record in them , then
pass the array in a find and call sum on it.

f.hidden :things, thing.id[]


then

find(params[:things])


On Sat, Sep 11, 2010 at 5:45 AM, Fidel Viegas <[email protected]>wrote:

> On 9/11/10, Frederick Cheung <[email protected]> wrote:
> >
> >
> > On Sep 10, 7:50 pm, Fidel Viegas <[email protected]> wrote:
> >> On 9/10/10, radhames brito <[email protected]> wrote:
> >>
> >> > AR has a sum function.
> >>
> >> Hi Radhames,
> >>
> >> I am aware of the sum function, but it does not do cumulative sum on
> >> its own. I know how to do it using recursive queries or stored
> >> procedures, but my question is how to deal with that using
> >> will_paginate.
> >>
> >> I will try to read the api and see if I can tweak it.
> >>
> >
> > The sum function takes conditions just like find does. Depending on
> > what you are sorting on you should be able to construct the relevant
> > conditions from the items will paginate fetches for you.
>
> For the problem in question that does not work. I read through the
> documentation and found out that I could paginate_by_sql, which is
> what I really needed.
>
> Thanks a lot!!!!
>
> Regards,
>
> Fidel.
>
> --
> 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]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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