instance method method_missing

Ruby on Rails 7.2.3

Since v7.1.6 Private

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

method_missing(name, ...)

No documentation comment.

Parameters

name req
... req
Source
# 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

Defined in activerecord/lib/active_record/attribute_methods.rb line 475 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::AttributeMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close