I have a small Rails application I'm creating.

I have for example a field called "sales_result".

I also have another two fields, namely, "price" and "quantity_sold".

I have the following formula:

sales_result = price * quantity_sold

How can I perform this formula in my rails application? Such that, when

I for example enter the following values:

price = 3.0

quantity_sold = 3

I get this result calculated automatically for "sales_result":

sales_result = 9

Where should I start in the Rails application in performing this

calculation?

Thanks.