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
http://tinyurl.com/yrc77g <-- assert_latest Model
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---