diff options
author | Dan Neumann <danneumanntx@gmail.com> | 2011-02-13 17:50:39 -0600 |
---|---|---|
committer | Dan Neumann <danneumanntx@gmail.com> | 2011-02-13 17:50:39 -0600 |
commit | f7a31ce1cd23b2f05a80d5c954e9a9b833665618 (patch) | |
tree | 2faae6f2e0947bd2f6e943b710eba1157df818ea | |
parent | 0617d3e3c607d6e65a107190cff5404d0b55c790 (diff) | |
download | rails-f7a31ce1cd23b2f05a80d5c954e9a9b833665618.tar.gz rails-f7a31ce1cd23b2f05a80d5c954e9a9b833665618.tar.bz2 rails-f7a31ce1cd23b2f05a80d5c954e9a9b833665618.zip |
Added simple demonstration of has_many :through
-rw-r--r-- | railties/guides/source/association_basics.textile | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile index f22f41e8b1..23bfafa640 100644 --- a/railties/guides/source/association_basics.textile +++ b/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: |