Hi everybody!! I''m newbie in Rails and Ruby so I need a bit of help!!!. Is it possible to have an has_many_and_belongs_to relationship to itself/self-referential? Or, as an alternative, is there such a thing like acts_as_graph? I know that acts_as_tree exists... but I need to represent a (directed acyclic graph) where an item can have many children but also multiple parents. Thank you in advance for your consideration, Edoardo "Dado" Marcora
Edoardo Marcora wrote:> Hi everybody!! I''m newbie in Rails and Ruby so I need a bit of help!!!. > > Is it possible to have an has_many_and_belongs_to relationship to > itself/self-referential? Or, as an alternative, is there such a thing like > acts_as_graph? >See: http://wiki.rubyonrails.org/rails/pages/HowToUseManyToManyAgainstASingleTable Eszter -- Primalgrasp LLC http://primalgrasp.com
Thanx for the pointer!!! I am amazed by how easy is to implement this sort of self-referential joins. Dado Biro Eszter wrote:> Edoardo Marcora wrote: >> Hi everybody!! I''m newbie in Rails and Ruby so I need a bit of help!!!. >> >> Is it possible to have an has_many_and_belongs_to relationship to >> itself/self-referential? Or, as an alternative, is there such a thing >> like acts_as_graph? >> > > See: >http://wiki.rubyonrails.org/rails/pages/HowToUseManyToManyAgainstASingleTable> > Eszter >