class ActiveRecord::Delegation::GeneratedRelationMethods

:nodoc:

def generate_method(method)

def generate_method(method)
  MUTEX.synchronize do
    return if method_defined?(method)
    if /\A[a-zA-Z_]\w*[!?]?\z/.match?(method) && !::ActiveSupport::Delegation::RESERVED_METHOD_NAMES.include?(method.to_s)
      module_eval <<-RUBY, __FILE__, __LINE__ + 1
        def #{method}(...)
          scoping { model.#{method}(...) }
        end
      RUBY
    else
      define_method(method) do |*args, **kwargs, &block|
        scoping { model.public_send(method, *args, **kwargs, &block) }
      end
    end
  end
end