2011-11-07 10:47:28 +00:00
|
|
|
module Devise
|
2011-11-07 11:04:16 +00:00
|
|
|
# Checks the scope in the given environment and returns the associated failure app.
|
2011-11-07 10:47:28 +00:00
|
|
|
class Delegator
|
|
|
|
def call(env)
|
2011-11-07 11:04:16 +00:00
|
|
|
failure_app(env).call(env)
|
|
|
|
end
|
|
|
|
|
|
|
|
def failure_app(env)
|
|
|
|
app = env["warden.options"] &&
|
|
|
|
(scope = env["warden.options"][:scope]) &&
|
2011-12-07 10:01:16 +00:00
|
|
|
Devise.mappings[scope.to_sym].failure_app
|
2011-11-07 11:04:16 +00:00
|
|
|
|
|
|
|
app || Devise::FailureApp
|
2011-11-07 10:47:28 +00:00
|
|
|
end
|
|
|
|
end
|
2011-12-07 10:01:16 +00:00
|
|
|
end
|