Created
February 2, 2009 22:51
-
-
Save agile/57150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
has_many :bars | |
has_many :bazs | |
end | |
class Bar | |
belongs_to :foo | |
has_many :bazs, :through => :foo | |
end | |
class Baz | |
belongs_to :foo | |
end | |
@foo = Foo.find(1) | |
@bar = @foo.bars.build(:foo => @foo) | |
# Why even passing the @foo instance explicitly in, | |
# I my through association for bazs doesn't get populated? | |
@foo.bazs => [1, 2, 3] | |
@bar.bazs => [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment