Class: DevisePaypal::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/devise_paypal/rails.rb

Instance Method Summary collapse

Instance Method Details

#eager_load!Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/devise_paypal/rails.rb', line 7

def eager_load!
  mappings    = Devise.mappings.values.map(&:modules).flatten.uniq
  controllers = Devise::CONTROLLERS.values_at(*mappings)
  path        = paths.app.controllers.to_a.first
  matcher     = /\A#{Regexp.escape(path)}\/(.*)\.rb\Z/

  Dir.glob("#{path}/devise/{#{controllers.join(',')}}_controller.rb").sort.each do |file|
    require_dependency file.sub(matcher, '\1')
  end

  super
end