method
method_missing
v7.2.3 -
Show latest stable
- Class:
ActiveRecord::AttributeMethods
method_missing(name, ...)private
No documentation available.
# File activerecord/lib/active_record/attribute_methods.rb, line 475
def method_missing(name, ...)
# We can't know whether some method was defined or not because
# multiple thread might be concurrently be in this code path.
# So the first one would define the methods and the others would
# appear to already have them.
self.class.define_attribute_methods
# So in all cases we must behave as if the method was just defined.
method = begin
self.class.public_instance_method(name)
rescue NameError
nil
end
# The method might be explicitly defined in the model, but call a generated
# method with super. So we must resume the call chain at the right step.
method = method.super_method while method && !method.owner.is_a?(GeneratedAttributeMethods)
if method
method.bind_call(self, ...)
else
super
end
end