gpt4 book ai didi

devise - 未定义方法failure_app,为nil :NilClass

转载 作者:行者123 更新时间:2023-12-04 08:45:24 28 4
gpt4 key购买 nike

我正在尝试使用Rails应用程序中的devise来授予对Rack中间件中的Sinatra应用程序的访问权限。

我的config/routes.rb有:

authenticate "admin" do
mount Admins::Dashboard, :at => "/admins"
end

在我的Sinatra应用程序中,我使用:
before do
env["warden"].authenticate!(:scope => "admin")
end

get "/dashboard" do
erb :dashboard
end

现在,出现以下堆栈跟踪错误:
Started GET "/admins/dashboard" for 127.0.0.1 at 2012-10-11 08:45:13 +0200

NoMethodError (undefined method `failure_app' for nil:NilClass):
devise (2.1.2) lib/devise/delegator.rb:11:in `failure_app'
devise (2.1.2) lib/devise/delegator.rb:5:in `call'
warden (1.2.1) lib/warden/manager.rb:130:in `call_failure_app'
warden (1.2.1) lib/warden/manager.rb:116:in `process_unauthenticated'
warden (1.2.1) lib/warden/manager.rb:47:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'

最佳答案

该错误消息是有关缺少的配置的投诉,该配置用于自定义Warden故障应用以指向sinatra。

checkout this previous answerthe related (detailed) blogpost about setting up Sinatra+Warden & Rails+Devise;希望那里的说明将帮助您成功实现该解决方案。

关于devise - 未定义方法failure_app,为nil :NilClass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12833859/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com