Deprecate `scope_chain` #27851

merged 5 commits into from Jan 30, 2017


None yet

5 participants


This PR refactors reflections such that we can iterate over each reflection and ask the reflection object what scopes should be applied to the query we are currently building. This means we don't need to construct a scope_chain array and iterate that array in parallel with the "chain". Instead, we can just ask each item in the chain for the scopes that should be applied, then apply those scopes.

eileencodes and others added some commits Jan 30, 2017
@eileencodes @tenderlove eileencodes Implement `scopes` method on each Reflection
Each reflection should be responsible for returning the scopes needed to
query against the db.
@tenderlove tenderlove Fix `scopes` implementation on `PolymorphicReflection`
`PolymorphicReflection` needs to be custom for handling scope lambdas
@tenderlove tenderlove remove caching until we prove it is required d385162
@tenderlove tenderlove update comments and call `super`
@tenderlove tenderlove deprecate `scope_chain`
@tenderlove tenderlove merged commit ef7b9b8 into rails:master Jan 30, 2017

2 checks passed

codeclimate no new or fixed issues
continuous-integration/travis-ci/pr The Travis CI build passed
@tenderlove tenderlove deleted the tenderlove:scope-chain branch Jan 30, 2017


def constraints
- scope_chain.flatten
WaKeMaTTa Feb 4, 2017

Is better to use flat_map in stead of map().flatten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment