method
method_missing
v8.0.0 -
Show latest stable
- Class:
ActiveRecord::AttributeMethods
method_missing(name, ...)private
No documentation available.
# File activerecord/lib/active_record/attribute_methods.rb, line 474
def method_missing(name, ...)
unless self.class.attribute_methods_generated?
if self.class.method_defined?(name)
# The method is explicitly defined in the model, but calls a generated
# method with super. So we must resume the call chain at the right step.
last_method = method(name)
last_method = last_method.super_method while last_method.super_method
self.class.define_attribute_methods
if last_method.super_method
return last_method.super_method.call(...)
end
elsif self.class.define_attribute_methods
# Some attribute methods weren't generated yet, we retry the call
return public_send(name, ...)
end
end
super
end