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.

Equality Problems with ActiveResource::Base

#1098

The == method was improperly implemented. Therefore, the test provided in the patch would fail. Essentially, two resources with different prefix options passed the equality check. I don't think the .equal? should have been used in the object equality comparison implementation (== method), as per the RDoc for Object "it is used to determine object identity (that is, a.equal?(b) iff a is the same object as b)". For now, I think comparing, at minimum, the id and prefix_options fields is appropriate.

Reported by rbpandey · September 23rd, 2008 @ 09:42 PM

State: resolved
Milestone: none
Assigned to: Pratik Pratik
Importance: none

Activity

  1. jack dempsey (jackdempsey)
    jack dempsey (jackdempsey)
    • Tag set to activeresource, bug

    Makes sense to me--two resources with different prefix options shouldn't be equal.

    September 23rd, 2008 @ 10:14 PM

  2. rbpandey
    rbpandey

    Here is the latest patch. I added back the .equals check as I was confused by some buggy behavior in Base.reload.

    September 25th, 2008 @ 06:36 PM

  3. Pratik
    Pratik
    • Milestone cleared.
    • Assigned user set to Pratik

    January 18th, 2009 @ 05:46 AM

  4. Repository
    Repository
    • State changed from new to resolved

    (from [6079ec1f77daf364a2b25cf651e9b3c9e1b95a16]) ActiveResource#eqls? and == should not take into account object identity and prefix options should be considered. [#1098 state:resolved]

    Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...

    January 28th, 2009 @ 08:01 PM