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
|
@ -199,7 +199,7 @@ module ActiveRecord
|
|||
|
||||
private
|
||||
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
|
||||
|
||||
def valid_scope_name?(name)
|
||||
|
|
|
@ -10,9 +10,14 @@ class Reply < Topic
|
|||
|
||||
scope :ordered, -> { Reply.order(:id) }
|
||||
|
||||
# Method on Kernel
|
||||
def self.open
|
||||
approved
|
||||
end
|
||||
|
||||
# Methods both on Kernel and Relation
|
||||
def self.load(data:); end
|
||||
def self.select(data:); end
|
||||
end
|
||||
|
||||
class SillyReply < Topic
|
||||
|
|
Loading…
Reference in New Issue