mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Remove crazy controllers handling code.
This commit is contained in:
parent
3d1152fb8f
commit
31edd76369
1 changed files with 2 additions and 22 deletions
|
@ -5,12 +5,6 @@ module Devise
|
|||
class Engine < ::Rails::Engine
|
||||
config.devise = Devise
|
||||
|
||||
# Skip eager load of controllers because it is handled by Devise
|
||||
# to avoid loading unused controllers.
|
||||
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|
|
||||
Devise.warden_config = config
|
||||
|
@ -20,8 +14,8 @@ module Devise
|
|||
config.before_eager_load { |app| app.reload_routes! }
|
||||
|
||||
initializer "devise.add_filters" do |app|
|
||||
app.config.filter_parameters += [:password, :password_confirmation]
|
||||
app.config.filter_parameters.uniq
|
||||
app.config.filter_parameters += [:password]
|
||||
app.config.filter_parameters.uniq!
|
||||
end
|
||||
|
||||
initializer "devise.url_helpers" do
|
||||
|
@ -56,19 +50,5 @@ module Devise
|
|||
"to your models and comment the current value in the config/initializers/devise.rb"
|
||||
end
|
||||
end
|
||||
|
||||
# Check all available mappings and only load related controllers.
|
||||
def eager_load!
|
||||
mappings = Devise.mappings.values.map(&:modules).flatten.uniq
|
||||
controllers = Devise::CONTROLLERS.values_at(*mappings)
|
||||
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|
|
||||
require_dependency file.sub(matcher, '\1')
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue