Q: refers_to / belongs_to vs. joins_many / many_to_many

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

On 10/16/07, Robert M. [email protected] 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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs