Module: ActiveRecord::Precount::Builder::HasManyExtension

Defined in:
lib/active_record/precount/has_many_extension.rb

Instance Method Summary collapse

Instance Method Details

#build(model) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/active_record/precount/has_many_extension.rb', line 12

def build(model, name, scope, options, &block)
  if scope.is_a?(Hash)
    options = scope
    scope   = nil
  end

  if options[:count_loader]
    CountLoaderBuilder.new(model).build_from_has_many(name, scope, options)
  end
  super
end

#valid_optionsObject



7
8
9
# File 'lib/active_record/precount/has_many_extension.rb', line 7

def valid_options(*)
  super + [:count_loader]
end