method

generate_method

Importance_0
v7.1.3.2 - Show latest stable - 0 notes - Class: GeneratedRelationMethods
generate_method(method) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/relation/delegation.rb, line 72
      def generate_method(method)
        synchronize do
          return if method_defined?(method)

          if /\A[a-zA-Z_]\w*[!?]?\z/.match?(method) && !DELEGATION_RESERVED_METHOD_NAMES.include?(method.to_s)
            module_eval               def #{method}(...)                scoping { klass.#{method}(...) }              end, __FILE__, __LINE__ + 1
          else
            define_method(method) do |*args, &block|
              scoping { klass.public_send(method, *args, &block) }
            end
            ruby2_keywords(method)
          end
        end
      end
Register or log in to add new notes.