1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Use default_url_options from parent_controller

Use a configured Devise.parent_controller, not ApplicationController
Also remove passing `*args` since it's a class-level attribute, not
a method.
This commit is contained in:
Marcus Ilgner 2015-08-20 17:56:08 +02:00
parent 359fba970e
commit 8aa0e2655e
No known key found for this signature in database
GPG key ID: E31D682E2F71FB99

View file

@ -22,9 +22,12 @@ module Devise
@respond.call(env)
end
# Try retrieving the URL options from the parent controller (usually
# ApplicationController). Instance methods are not supported at the moment,
# so only the class-level attribute is used.
def self.default_url_options(*args)
if defined?(ApplicationController)
ApplicationController.default_url_options(*args)
if defined?(Devise.parent_controller.constantize)
Devise.parent_controller.constantize.try(:default_url_options) || {}
else
{}
end