title: Ruby on Rails: question about validates_presence_of
body: <p>I have a relationship in my ActiveRecord based model that looks like:</p>
  
  <pre><code>belongs_to :foo
  </code></pre>
  
  <p>My model should always have foo defined in it for it to be valid. My question is, when using validates_presence of, which one is the appropriate one to use:</p>
  
  <pre><code>validates_presence_of :foo
  </code></pre>
  
  <p>or</p>
  
  <pre><code>validates_presence_of :foo_id
  </code></pre>
  
  <p>Assuming here of course, that foo_id is the appropriate foreign key, which it is by default if you do not change the association key.</p>