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.

ActiveRecord::Relation#except and #only loses scope extensions

#6598

Given a scope with extensions
When I use the except to remove a part from the relation
Then the extensions are gone, because except returns a brand new relation object.

This means the following doesn't work (when using Kaminari, which uses extensions):

Post.page(2).except(:order).current_page

Because the current_page method was added by the page scope.

This issue is present in at least 3.0.5 and master.

The supplied patch will apply the extensions again after using except and only.

There is some duplication going on in both methods. A private method could certainly be extracted (although I'm clueless on a name).

Edit: GitHub pull request started working again: https://github.com/rails/rails/pull/231

Reported by iain · March 19th, 2011 @ 09:35 PM

State: committed
Milestone: 3.0.6
Assigned to: Aaron Patterson Aaron Patterson
Importance: Low

Activity

  1. 2kan
    2kan
    • Tag changed from activerecord, patch to rails edge, activerecord, patch
    • Assigned user set to Aaron Patterson

    March 21st, 2011 @ 12:31 PM

  2. Aaron Patterson
    Aaron Patterson
    • State changed from new to committed
    • Milestone set to 3.0.6
    • Importance changed from to Low

    Merged. Thanks!

    March 21st, 2011 @ 05:31 PM