提交 b1bb8b2a 编写于 作者: J John Firebaugh

Eager autoload Preloader classes

Without eager autoloading, these would be autoloaded
only when #preloader_for is called, which is too late
in threaded applications.
上级 f73c2599
......@@ -30,6 +30,9 @@ module Associations
# option references an association's column), it will fallback to the table
# join strategy.
class Preloader #:nodoc:
extend ActiveSupport::Autoload
eager_autoload do
autoload :Association, 'active_record/associations/preloader/association'
autoload :SingularAssociation, 'active_record/associations/preloader/singular_association'
autoload :CollectionAssociation, 'active_record/associations/preloader/collection_association'
......@@ -41,6 +44,7 @@ class Preloader #:nodoc:
autoload :HasOneThrough, 'active_record/associations/preloader/has_one_through'
autoload :HasAndBelongsToMany, 'active_record/associations/preloader/has_and_belongs_to_many'
autoload :BelongsTo, 'active_record/associations/preloader/belongs_to'
end
attr_reader :records, :associations, :preload_scope, :model
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册