387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
|
# File 'lib/store_base_sti_class_for_5_0.rb', line 387
def scope_chain
@scope_chain ||= begin
scope_chain = source_reflection.scope_chain.map(&:dup)
scope_chain.first << scope if scope
through_scope_chain = through_reflection.scope_chain.map(&:dup)
if options[:source_type]
type = foreign_type
source_type =
if ActiveRecord::Base.store_base_sti_class
options[:source_type]
else
([options[:source_type].constantize] + options[:source_type].constantize.descendants).map(&:to_s)
end
through_scope_chain.first << lambda { |object|
where(type => source_type)
}
end
scope_chain + through_scope_chain
end
end
|