title: In Ruby on Rails, how can a model "has_many" and "belong_to" using a different field other than primary ID?
body: <p>I am trying building a simple project from scratch using Rails 3.  Usually, the models are like:</p>
  
  <pre><code>class Student &lt; ActiveRecord::Base
    has_many :awards
  end
  
  class Award &lt; ActiveRecord::Base
    belongs_to :student
  end
  </code></pre>
  
  <p>and we use the <code>award.id</code> and <code>student.id</code> to get the corresponding records.</p>
  
  <p>But what if it is</p>
  
  <pre><code>class Company &lt; ActiveRecord::Base
    has_many :stock_quotes
  end
  
  
  class StockQuote &lt; ActiveRecord::Base
    belong_to :company
  end
  </code></pre>
  
  <p>In this case, we can use the symbol of the company, such as <code>MSFT</code> or <code>GOOG</code> to identify the company, instead of using the company.id.  For example, in stock_quotes, we can store the symbol of the company directly instead of using <code>company.id</code>.  In this case, is there a way to specify it in the models?</p>