On Miércoles, 19 de Octubre de 2011 21:04:45 SOREN CHRISTENSEN escribió:
> Excellent.
> 
> Forgot to say that I'm in 2.3 but back ported the proc ability to
> AS2.3/2.4.
> 
> How to you override the formatting for the calculation, or is the proc
> supposed to return everything ?
> 

You should define render_quantity_sold_sum method to formatting the calculation
Or you can format it in the proc

> /S
> 
> On 10/19/11 5:20 AM, "Sergio Cambra .:: entreCables S.L. ::."
> 
> <[email protected]> wrote:
> >On Martes, 18 de Octubre de 2011 00:57:23 SOREN CHRISTENSEN escribió:
> >> Hi,
> >> 
> >> Has anyone put in the effort to get the standard ActiveScaffold
> >> calculations work on Virtual Coulmns?
> >> 
> >> Quantity_sold is a virtual column defined in the model (as opposed to
> >>
> >>being
> >>
> >> a database column). But AS does not support calculations for those.
> >> 
> >> config.columns[:quantity_sold].calculate = :sum
> >> 
> >> Is this doable with reasonable effort ?
> >> 
> >> /S
> >
> >You must set a proc, for example:
> >
> >config.columns[:quantity_sold].calculate = proc{|records|
> >records.map(&:quantity_sold).sum}

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

Reply via email to