title: Rails belongs_to many models
body: <p>I did find some questions on SO about Rails associations that are somewhat like my question, but for the life of me I can't seem to understand how to use <code>belongs_to</code> multiple models.</p>
  
  <p>Here's the <em>table structure</em> I intend to have:</p>
  
  <pre><code>User
   id
  
  Post
   id
   user_id #foreign key; a post belongs to a User aka "Who created this post"
  
  Comment
   id
   user_id #foreign key; a comment belongs to a User aka "Who made this comment"
   post_id #foreign key; a comment belongs to a Post aka "What post this comment is for"
  </code></pre>
  
  <p>And the <em>associations</em>:</p>
  
  <pre><code>User
   has_many :posts
   has_many :comments
  
  Post
   belongs_to :user
   has_many :comments
  
  Comment
   belongs_to :user
   belongs_to :post
  </code></pre>
  
  <p>Is this the correct approach?</p>