Skip to content

Commit

Permalink
Added simple demonstration of has_many :through
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Neumann committed Feb 13, 2011
1 parent 0617d3e commit f7a31ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions railties/guides/source/association_basics.textile
Expand Up @@ -165,6 +165,12 @@ class Paragraph < ActiveRecord::Base
end end
</ruby> </ruby>


With +:through => :sections+ specified, Rails will now understand:

<ruby>
@document.paragraphs
</ruby>

h4. The +has_one :through+ Association 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: 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:
Expand Down

0 comments on commit f7a31ce

Please sign in to comment.