I noticed that you can''t cascade an include more than twice on the
same association (for has_many at least). It seems that the
association name table alias is used as a key to store the number of
times that the association has been used in the include. This allows
the alias to change for each subsequent join. However, the way that
the code was written caused a new key to be used each time the alias
count was incremented. As a result, you could not cascade more than
twice on an association:
Tree.find(:first, :include => {:children => {:children => :children}})
The attached diff fixes this issue and passes all unit tests.
Rich
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core
On 8/13/06, Rich Collins <richcollins@gmail.com> wrote:> > I noticed that you can''t cascade an include more than twice on the > same association (for has_many at least). It seems that the > association name table alias is used as a key to store the number of > times that the association has been used in the include. This allows > the alias to change for each subsequent join. However, the way that > the code was written caused a new key to be used each time the alias > count was incremented. As a result, you could not cascade more than > twice on an association: > > Tree.find(:first, :include => {:children => {:children => :children}}) > > The attached diff fixes this issue and passes all unit tests.Thanks Rich! http://dev.rubyonrails.org/changeset/4758 (trac willing) jeremy _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core
I still need to try to get them working for other types of associations. I will submit another patch when I get a chance. Glad I could help! Rich On Aug 14, 2006, at 12:22 AM, Jeremy Kemper wrote:> On 8/13/06, Rich Collins <richcollins@gmail.com> wrote: > I noticed that you can''t cascade an include more than twice on the > same association (for has_many at least). It seems that the > association name table alias is used as a key to store the number of > times that the association has been used in the include. This allows > the alias to change for each subsequent join. However, the way that > the code was written caused a new key to be used each time the alias > count was incremented. As a result, you could not cascade more than > twice on an association: > > Tree.find(:first, :include => {:children => {:children => :children}}) > > The attached diff fixes this issue and passes all unit tests. > > > Thanks Rich! > > http://dev.rubyonrails.org/changeset/4758 (trac willing) > > jeremy > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core_______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core