Using count in index page cards leads to loading the whole collection
Reported by Betelgeuse | December 12th, 2009 @ 03:17 PM | in Beyond Hobo 1.0
Splitting from #261 to ensure at least this gets resolved before 1.0. The information about this is in the comments in that bug. The short story is that hitting method_missing on a has_many which happens with count leads to loading the whole collection. This means that if the count is huge the index page does not load any more.
Comments and changes to this ticket
-
Matt Jones December 13th, 2009 @ 11:44 PM
- Assigned user set to Matt Jones
- State changed from new to investigating
- Milestone set to Hobo 1.0 - Final
Some further digging reveals that the method that's triggering the collection load is is_a? - which really shouldn't be, given that an AssociationCollection or a Scope is pretty much supposed to act like an Array, and there's not (AFAIK) any way to end up with any other class besides Array...
The quick solution would be to define is_a? on AssociationCollection, in the same way that try is handled. However, the real solution will be to review all the methods of Array and avoid loading / delegating ones that aren't dependent on the contents of the Array itself.
-
Owen January 10th, 2010 @ 07:24 PM
- State changed from investigating to open
Just checking to see the status of this one...
-
Matt Jones January 18th, 2010 @ 04:00 AM
- State changed from open to hold
- Milestone changed from Hobo 1.0 - Final to Beyond Hobo 1.0
We now explicitly handle is_a?, so this issue should be resolved as of 460e3492ab35b34ec9b5f9e71be91fe7113ef514. I'm putting in 'hold' to remind myself to write the relevant patch up for the Rails LH.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
People watching this ticket
Tags
Referenced by
- 261 Calling respond_to? on something that might be a scoped association can cause the full collection to load I opened #584 to make sure at least count gets fixed befo...
- 261 Calling respond_to? on something that might be a scoped association can cause the full collection to load Your commit passes my unit test for try but #584 remains ...
- 261 Calling respond_to? on something that might be a scoped association can cause the full collection to load Your commit passes my unit test for try but #584 remains ...
- 261 Calling respond_to? on something that might be a scoped association can cause the full collection to load #584 captures the other half of this (with is_a?), so I'l...