Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

AssociationCollection #first and #last cache.

#1751

Sometimes when testing or in irb, I seem to forget that the following does not work:


first = firm.clients.first
firm.clients.each { ... } # loads the target and thus the instance is gone
firm.clients.first.object_id == first.object_id # => false

This patch solves this.

Note that the same queries as normal are executed, just the instance in the collection result is replaced.

Reported by Eloy Duran · January 13th, 2009 @ 07:39 PM

State: wontfix
Milestone: 2.x
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. Eloy Duran
    Eloy Duran
    • Assigned user set to Michael Koziarski

    February 7th, 2009 @ 02:42 PM

  2. Michael Koziarski
    Michael Koziarski
    • State changed from new to wontfix

    I'd prefer not to apply a one off fix for this problem, instead a wider fix involving an identity map or something similar would be better.

    February 7th, 2009 @ 10:11 PM

  3. Eloy Duran
    Eloy Duran

    Yeah I understand, an identity map would be much better. Another time ;-)

    February 8th, 2009 @ 12:23 AM