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 24. Aug '21

Howto Debug Session Variable in a Controller or View

You can’t just inspect session object since it contains lots of crap added by middlewares and Rails itself. To see only keys from session cookie do this:

puts 'SESSION', session.keys.reduce([]) {|result, key| result << [key, session[key]]}.inspect

Add Comment