I have two fields namely cost
and var_cost
both of type Integer
, User can enter a number in the text field, on submit the number will be updated for the cost
field for multiple records, but var_cost
of the individual record should be added to the number before assigning it to the cost
field.
Variation.where(conditions).update_all(cost: number + var_cost)
I have tried this but it is not working, is there a way to use var_cost
of individual record with update_all
, any help would be highly appreciated!