Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)copy! share!
posted at 05. Dec '20
last updated at 18. Oct '24

Debugging Devise

Let’s face it - Devise errors can be very cryptic as fuck and the Warden ones are just hell.

So….for debugging Warden stuff I use custom failure app:

class CustomDeviseFailureApp < Devise::FailureApp
  def respond
    super
    puts 'XXXXXX', warden.inspect, warden_options.inspect, warden_message.inspect, warden_options[:recall]&.inspect
  end
end

and something like this in Devise config:

  config.warden do |manager|
    Warden::Manager.before_failure do |env, opts|
      puts 'config.warden', opts.inspect
      req = Rack::Request.new(env)
      puts 'user:', req.params['user'].inspect
    end
  end

Changes:

  • fix typo in inpect

Add Comment