Remove deprecation warnings on Rails 3.1.

This commit is contained in:
José Valim 2010-10-10 15:49:47 +02:00
parent 721843c841
commit 94ccfc5322
1 changed files with 4 additions and 3 deletions

View File

@ -7,8 +7,9 @@ module Devise
# Skip eager load of controllers because it is handled by Devise
# to avoid loading unused controllers.
config.paths.app.controllers.autoload!
config.paths.app.controllers.skip_eager_load!
target = paths.is_a?(Hash) ? paths["app/controllers"] : paths.app.controllers
target.autoload!
target.skip_eager_load!
# Initialize Warden and copy its configurations.
config.app_middleware.use Warden::Manager do |config|
@ -54,7 +55,7 @@ module Devise
def eager_load!
mappings = Devise.mappings.values.map(&:modules).flatten.uniq
controllers = Devise::CONTROLLERS.values_at(*mappings)
path = paths.app.controllers.to_a.first
path = paths.is_a?(Hash) ? paths["app/controllers"].first : paths.app.controllers.first
matcher = /\A#{Regexp.escape(path)}\/(.*)\.rb\Z/
Dir.glob("#{path}/devise/{#{controllers.join(',')}}_controller.rb").sort.each do |file|