lib/doorkeeper/orm/mongoid7.rb in doorkeeper-mongodb-4.0.1 vs lib/doorkeeper/orm/mongoid7.rb in doorkeeper-mongodb-4.1.0
- old
+ new
@@ -1,19 +1,29 @@
+require 'active_support/lazy_load_hooks'
+
module Doorkeeper
module Orm
module Mongoid7
def self.initialize_models!
- require 'doorkeeper/orm/mongoid7/access_grant'
- require 'doorkeeper/orm/mongoid7/access_token'
- require 'doorkeeper/orm/mongoid7/application'
+ lazy_load do
+ require 'doorkeeper/orm/mongoid7/access_grant'
+ require 'doorkeeper/orm/mongoid7/access_token'
+ require 'doorkeeper/orm/mongoid7/application'
+ end
end
def self.initialize_application_owner!
- require 'doorkeeper/models/concerns/ownership'
+ lazy_load do
+ require 'doorkeeper/models/concerns/ownership'
- Doorkeeper::Application.send :include, Doorkeeper::Models::Ownership
+ Doorkeeper::Application.send :include, Doorkeeper::Models::Ownership
+ end
end
def self.check_requirements!(_config); end
+
+ def self.lazy_load(&block)
+ ActiveSupport.on_load(:mongoid, {}, &block)
+ end
end
end
end