1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/active_record/scoping
Ryuta Kamizono 136b738cd2 Generate delegation methods to named scope in the definition time
The delegation methods to named scope are defined when `method_missing`
is invoked on the relation.

Since #29301, the receiver in the named scope is changed to the relation
like others (e.g. `default_scope`, etc) for consistency.

Most named scopes would be delegated from relation by `method_missing`,
since we don't allow scopes to be defined which conflict with instance
methods on `Relation` (#31179). But if a named scope is defined with the
same name as any method on the `superclass` (e.g. `Kernel.open`), the
`method_missing` on the relation is not invoked.

To address the issue, make the delegation methods to named scope is
generated in the definition time.

Fixes #34098.
2018-10-09 13:03:08 +09:00
..
default.rb Move scoping handling into klass level from relation 2018-09-11 21:25:41 +09:00
named.rb Generate delegation methods to named scope in the definition time 2018-10-09 13:03:08 +09:00