title: Rails Nested Associations and Scopes
body: <p>I'm trying to learn arel/scopes in Rails..
  I have the following models..</p>
  
  <pre><code>Class Category
    has_many :questions
  
  Class Question
    belongs_to :category
    has_many :answers
  
  Class Answer
    belongs_to :question
    # attributes: owner_name
  </code></pre>
  
  <p>I'm trying to find Categories that have answers with the owner_name, say "bob". For this I was thinking of adding a has_many :through relationship between Category and Answer and then accessing answers of a category using..</p>
  
  <pre><code>Category.find_each do |c|
    c.answers.find_by_owner_name("bob")
  end
  </code></pre>
  
  <p>..but this seems like an overkill and is lengthy. Can I do this better using a scope defined in the Category class?</p>
  
  <p>Thanks.</p>