Hi,

On a simple inventory model I have a set of fields representing price
and quantity.

I created a method to represent the value which is just as simple as:

 def value
    self.price * self.quantity
  end

Then I tried to add a few calculation fields to my AS.

    config.columns = :description, :cost, :price, :quantity, :value

    config.columns[:quantity].calculate = :sum
    config.columns[:value].calculate = :sum  #<<< Is this not
possible ?

If I add a sum field to my value field I get an error message:
Mysql::Error: Unknown column 'value' in 'field list': SELECT sum
(value) AS sum_value FROM `scrips`

Is it not possible to have calculation fields on virtual fields ?
And why is AS trying to fetch the virtual field from the DB and not
from the model ?

/S

--

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].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=.


Reply via email to