Skip to content

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

wants to merge 1 commit into from

2 participants

iain commented Mar 19, 2011

Repeating what I've said in Lighthouse ticket 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):

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).

Ruby on Rails member

Merged. Thank you!

@tenderlove tenderlove closed this Mar 21, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.