From f7a31ce1cd23b2f05a80d5c954e9a9b833665618 Mon Sep 17 00:00:00 2001 From: Dan Neumann Date: Sun, 13 Feb 2011 17:50:39 -0600 Subject: Added simple demonstration of has_many :through --- railties/guides/source/association_basics.textile | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'railties') 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 +With +:through => :sections+ specified, Rails will now understand: + + + @document.paragraphs + + 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: -- cgit v1.2.3