title: Retrieving all posts from a board that a user's subscribed to
body: <p>I'm currently setting up a feed from scratch where a user subscribes to multiple message boards and would receive all of the posts created under that board. This is how I have my code written so far:</p>
  
  <pre><code>class User &lt; ApplicationRecord
    has_many :subscriptions, dependent: :destroy
    has_many :boards, through: :subscriptions
  end
  
  class Subscription &lt; ApplicationRecord
    belongs_to :user
    belongs_to :board
  end
  
  class Board &lt; ApplicationRecord
    has_many :subscriptions, dependent: :destroy
    has_many :subscribers, through: :subscriptions, source: :user
  end
  
  class Post &lt; ApplicationRecord
    belongs_to :board
    belongs_to :user
  end
  </code></pre>
  
  <p>When it comes time to display the posts is where I'm having problems as far as the proper approach. Would the simple solution be to setup another HMT association in the user model as so?</p>
  
  <pre><code>has_many :subscribed_posts, through: :boards, source: :posts
  </code></pre>
  
  <p>One immediate flaw I see in my approach is that the user would get their posts to show up including those of other users. Would the better solution be to create some sort of SQL query?</p>