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.

Relation fails to act like an Array on intersection

#5552

ActivceRecord::Relations tries hard to act like an Array, but it fails when it comes to intersection (#&).

Test appended.

Reported by Kane · September 4th, 2010 @ 05:12 PM

State: committed
Milestone: none
Assigned to: Mikel Lindsaar Mikel Lindsaar
Importance: Low

Activity

  1. Marcelo Giorgi
    Marcelo Giorgi
    • Assigned user set to Santiago Pastorino
    • Tag set to patch

    Hi,

    I've just create a couple of patches to make this work.

    First, I tried to apply Kane's test but I couldn't (on master). So, I've just copied the idea of the test (only used with a different model so that we don't need to load books fixture in this file) and added a first patch with Kane as author.

    Then, my second patch is the working code that makes the test to pass.

    September 9th, 2010 @ 02:15 AM

  2. Kane
    Kane

    nice!

    this is exacly what i had in mind.
    No problems while appling it to current master.
    I think the test is straight forward, so is the implementation. +1 from me

    September 9th, 2010 @ 03:19 PM

  3. Nathan Kleyn
    Nathan Kleyn
    • Tag changed from patch to active record, activerecord relation, patch

    This applied fine for me, and seems to be exactly what's needed. +1 from me too.

    September 9th, 2010 @ 05:10 PM

  4. max.pettersen
    max.pettersen

    The implementation seems to be correct for me, and also the test passes properly. +1

    September 9th, 2010 @ 07:15 PM

  5. Marcelo Giorgi
    Marcelo Giorgi
    • Tag changed from active record, activerecord relation, patch to active record, activerecord relation, patch, verified

    Adding the verified tag now that 3 people have voted positively.

    September 9th, 2010 @ 10:27 PM

  6. Rizwan Reza
    Rizwan Reza
    • Importance changed from to Low

    Hey Marcelo,

    Can you send a pull request on Github to rails/rails for this one?

    Thanks!

    September 10th, 2010 @ 03:01 AM

  7. Marcelo Giorgi
  8. Mikel Lindsaar
    Mikel Lindsaar
    • Assigned user changed from Santiago Pastorino to Mikel Lindsaar

    OK, I am testing this now.

    September 10th, 2010 @ 12:16 PM

  9. Mikel Lindsaar
    Mikel Lindsaar
    • State changed from new to committed

    September 10th, 2010 @ 12:44 PM