Permalink
Browse files

Added simple demonstration of has_many :through

  • Loading branch information...
1 parent 0617d3e commit f7a31ce1cd23b2f05a80d5c954e9a9b833665618 Dan Neumann committed Feb 13, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 railties/guides/source/association_basics.textile
@@ -165,6 +165,12 @@ class Paragraph < ActiveRecord::Base
end
</ruby>
+With +:through => :sections+ specified, Rails will now understand:
+
+<ruby>
+ @document.paragraphs
+</ruby>
+
h4. The +has_one :through+ Association
A +has_one :through+ association sets up a one-to-one connection with another model. This association indicates that the declaring model can be matched with one instance of another model by proceeding _through_ a third model. For example, if each supplier has one account, and each account is associated with one account history, then the customer model could look like this:

0 comments on commit f7a31ce

Please sign in to comment.