instance method
dangerous_class_method?
Ruby on Rails 8.0.4
Since v4.1.16Signature
dangerous_class_method?(method_name)
A class method is ‘dangerous’ if it is already (re)defined by Active Record, but not by any ancestors. (So ‘puts’ is not dangerous but ‘new’ is.)
Parameters
-
method_namereq
Source
# File activerecord/lib/active_record/attribute_methods.rb, line 201
def dangerous_class_method?(method_name)
return true if RESTRICTED_CLASS_METHODS.include?(method_name.to_s)
if Base.respond_to?(method_name, true)
if Object.respond_to?(method_name, true)
Base.method(method_name).owner != Object.method(method_name).owner
else
true
end
else
false
end
end
Defined in activerecord/lib/active_record/attribute_methods.rb line 201
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods::ClassMethods