Railsers:
Our classes use these associations:
[Frog]-1—-[Adult]-—*-[Tadpole]
All adults are frogs, and each frog is mother or father to numerous
tadpoles.
Declaring the right-side association is easy, via the hidden
adults_tadpoles table:
Tadpole.has_and_belongs_to_many :adults
Adult.has_and_belongs_to_many :tadpoles
Declaring the -1–* is easy too, when each Adult has a frog_id:
Adult.belongs_to :frog
Frog.has_many :adults
Now how do we add a collection of tadpoles to Frog? This attempt…
Frog.has_many :tadpoles, :through => :adults, :source => :tadpoles
…invariably complains:
Invalid source reflection macro :has_and_belongs_to_many for
has_many :tadpoles,
:through => :adults. Use :source to specify the source reflection.
So, what’s a “source reflection”?
–
Phlip
http://www.oreilly.com/catalog/9780596510657/
^ assert_xpath
O'Reilly Media - Technology and Business Training ← assert_latest Model