title: How to change Foreign Keys on a Join Table?
body: <p>I have the following tables.</p>
  
  <pre><code>class Reward ActiveRecord::Base
    has_many :earned_rewards
    has_many :players, :through =&gt; :earned_rewards
  end
  
  class EarnedReward &lt; ActiveRecord::Base
    belongs_to :reward
    belongs_to :player
  end
  
  class Player &lt; ActiveRecord::Base
    has_many :earned_rewards
    has_many :rewards, :through =&gt; :earned_rewards
  end
  </code></pre>
  
  <p>My problem is that the Foreign Keys on the EarnedReward table are of type string, and don't conform to Rails conventions.  I want to add Integer fields (player_id, and reward_id) to the EarnedReward table to act as the new Foreign Keys, while keeping the old fields and their values.</p>
  
  <p>I'm using Rails 4.1.1 and I'm not sure exactly how to accomplish this.</p>