title: Update the database with new values after a migration
body: <p>I have a table in my database called <code>sessions</code> with two columns (<code>start_time</code> and <code>end_time</code>) in it and I already have lots of data in my table. I then generated a migration: </p>
  
  <pre><code>$ rails g migration AddDurationToSessions duration:integer 
  </code></pre>
  
  <p>My model <code>session.rb</code> looks like this: </p>
  
  <pre><code>class Session &lt; ActiveRecord::Base
     before_save :calc_duration
  
     def calc_duration
       return self[:end_time] - self[:start_time]
     end
  end
  </code></pre>
  
  <p>My question is: how do I apply <code>calc_duration</code> to all of my older elements in my table? Do I update them manually or is there a best practice for this? </p>