[Nitro] Q: refers_to / belongs_to vs. joins_many / many_to_many

Mark Van De Vyver mvyver at gmail.com
Wed Oct 17 01:48:23 EDT 2007


On 10/16/07, Robert Mela <rob at robmela.com> wrote:
> Poking about in og/relation/* and experimenting as I try to unravel this
> for http://robmela.com/cheatsheets/og_relations ( hopefully in a form
> that can be used in the rdocs for og or relation )

Thanks, for the cheat sheets!
Sorry I can't shed an light on the issue below - I haven't looked at
or given thought to that area of the code.

Mark
>
> BelongsTo inherits from RefersTo but with this annotation in "enchant"
>
>
>     target_class.ann!(:self)[:descendants] ||= []
>     target_class.ann!(:self, :descendants) << [owner_class, foreign_key]
>
> Something similar shows up in JoinsMany with a comment:
>
>       # Add join class to ann(:descendants) to be able to use cascade
> deletes.
>
>       owner_class.ann!(:self)[:descendants] ||= []
>       owner_class.ann!(:self, :descendants) << [tmp_join_class, owner_key]
>
>
> Is there a lack of symmetry here?
>
>    RefersTo <= BelongsTo, with descendants annotation on the *latter*
>    JoinsMany <= ManyToMany, with annotation on the *former*
>
>
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>
>


More information about the Nitro-general mailing list