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.