Undefined fail_app method for nil: NilClass

I am trying to use an application from Rails to provide access to a Sinatra application in Rack middleware.

My config / routes.rb has:

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

In my Sinatra application, I use:

 before do env["warden"].authenticate!(:scope => "admin") end get "/dashboard" do erb :dashboard end 

Now I get an error with the following stacktrace command:

 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' 
+6
source share
1 answer

The error message is a complaint about the missing configuration to configure the application to refuse monitoring, in order to indicate the sinatra.

Check out this previous answer and related (detailed) blog post about setting up Sinatra + Warden and Rails + Devise ; I hope that the instructions there will help you successfully implement the solution.

+3
source

Source: https://habr.com/ru/post/927424/


All Articles