mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #39256 from jhawthorn/methods_on_kernel_and_relation
Avoid confliting Kernel-named scopes on Relation
This commit is contained in:
commit
243d891072
2 changed files with 6 additions and 1 deletions
|
@ -199,7 +199,7 @@ module ActiveRecord
|
||||||
|
|
||||||
private
|
private
|
||||||
def singleton_method_added(name)
|
def singleton_method_added(name)
|
||||||
generate_relation_method(name) if Kernel.respond_to?(name)
|
generate_relation_method(name) if Kernel.respond_to?(name) && !ActiveRecord::Relation.method_defined?(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_scope_name?(name)
|
def valid_scope_name?(name)
|
||||||
|
|
|
@ -10,9 +10,14 @@ class Reply < Topic
|
||||||
|
|
||||||
scope :ordered, -> { Reply.order(:id) }
|
scope :ordered, -> { Reply.order(:id) }
|
||||||
|
|
||||||
|
# Method on Kernel
|
||||||
def self.open
|
def self.open
|
||||||
approved
|
approved
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Methods both on Kernel and Relation
|
||||||
|
def self.load(data:); end
|
||||||
|
def self.select(data:); end
|
||||||
end
|
end
|
||||||
|
|
||||||
class SillyReply < Topic
|
class SillyReply < Topic
|
||||||
|
|
Loading…
Reference in a new issue