title: Rename foreign keys automatically in activerecord
body: <p>I'm doing a rails migration to rename a table and I'd like to rename its foreign keys automatically. E.g. a <code>User</code> has many <code>posts</code>, and I'm renaming <code>User</code> to <code>Person</code></p>
  
  <pre><code>def change
    rename_table :users, :people
  end
  </code></pre>
  
  <p>I'd like to create automatically migrations like</p>
  
  <pre><code>def change
    rename_column :posts, :user_id, :person_id
  end
  </code></pre>
  
  <p>I've thought to get the model form the migration and look at its <code>has_many</code> models, e.g. as described in <a href="https://stackoverflow.com/a/14136941/165753">this answer</a>. Is there a simpler way?</p>