Forum: Nitro Q: refers_to / belongs_to vs. joins_many / many_to_many

Posted by Robert Mela (Guest)
on 2007-10-16 15:24
Attachment: rob.vcf (117 Bytes)
(Received via mailing list)
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 )


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*
Posted by Mark Van De Vyver (mvyver)
on 2007-10-17 07:58
(Received via mailing list)
On 10/16/07, Robert Mela <rob@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
This topic is locked and can not be replied to.