This project is archived and is in readonly mode.

#2896 ✓resolved
Diego Algorta

collection_singular_ids breaks when used with :include

Reported by Diego Algorta | July 9th, 2009 @ 09:30 PM | in 3.x

Given a has_many association defined with an :include option, you can't use the #collection_singular_ids method because it fails trying to eager load the 2nd level association when it's unneeded.

The attached patch includes a test case where you can see the need for it.

I'm not exactly happy with the patch because it involves adding a new :ignore_include valid option to ActiveRecord::Base.find, but I think I've read people requesting that kind of option too so maybe this is something you may want too.

Please review the patch and suggest any improvements or raise concerns.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages