title: Saving Repeated Iterations to Database
body: <p>I'm pretty new to rails. </p>
  
  <p>I have multiple datapoints that I am saving in my database for a subject called "quarterback". All of those datapoints are added together to for the value "xoi_qb". This calculation is performed in my model:</p>
  
  <pre><code>  def xoi_qb
      sum=0
      sum+= passing_yards|| 0
      sum+= passing_yards|| 0
      sum+= qb_rushing|| 0
  </code></pre>
  
  <p>Each value will change over time, and so the total of the sum, "xoi_qb", will change over time. Currently, the total for "xoi_qb" just updates and the previous total is lost.</p>
  
  <p>What I'd like to do is save each iteration of that total, every time it's changed. I don't want to do a "cron job", because I don't want to create a time-based schedule that performs a rake to see if any changes were made...I just want that total for each "quarterback" value "xoi_qb" to be saved to the database <strong><em>each time</em></strong> that I make a change. </p>
  
  <p>That way, each "quarterback" will end up with many "xoi_qb" values that go up and down in value. Right now, I just want to solve this and then eventually I'd like to plot the datapoints in a chart (with Highcharts or something similar). But for now, I just need to know how to save each "xoi_qb" total with each change.</p>
  
  <p>I have no idea how to do this. </p>