title: transitive rails associations and magical count
body: <p>In Rails, to automatically count associations, you do:</p>
  
  <pre><code>class Script
    has_many :chapters
  end
  class Chapter
    belongs_to :script
  end
  </code></pre>
  
  <p>and you add a chapters_count column into the Script model.</p>
  
  <p>Now, what if you want to count the number of paragraphs in a Script <em>without having a script_id key in the paragraph model ?</em></p>
  
  <pre><code>class Script
    has_many :chapters
    has_many :paragraphs # not complete
  end
  class Chapter
    has_many :paragraphs
    belongs_to :script
  end
  class Paragraph
    belongs_to :chapter
  end
  </code></pre>
  
  <p>How do you automatically associate script to paragraph and count them using the automatic count of Rails ?</p>