module ActiveRecord::QueryMethods

ActiveRecord 3.1 and 3.2 didn't try to bring in &block for the .extending() convenience thing that smartens up scopes, and Ruby 2.7 complained loudly about just doing the magical “Proc.new” that historically would just capture the incoming block.

Public Instance Methods

extending(*modules, &block) click to toggle source

These first two lines used to be: def extending(*modules)

modules << Module.new(&Proc.new) if block_given?
# File lib/duty_free.rb, line 245
def extending(*modules, &block)
  modules << Module.new(&block) if block_given?

  return self if modules.empty?

  relation = clone
  relation.send(:apply_modules, modules.flatten)
  relation
end