I have a form that is used to record a transaction. Liquid is moved from one tank to another. My form takes the from tank and the to tank and the number of gallons transferred. i would like this to be entered into the database as two rows. The first would be the from Tank ID and a negative number and the second row would be the to Tank ID and a positive number.
Example: Transferring 36 gallons from Tank 1 to Tank 2
id | tank_id | tran_amount
------------------------------
1 | 1 | -36
2 | 2 | 36
This is something that I would have achieved with ease writing SQL code in PHP but I am at a loss in Rails. How can I do this from one form?