smartinez87/exception_notification — pull request #192 by dmarkow (2013-10-14 19:20:21+00:00)
Title: Explicitly convert session to hash

In Rails 4.0, `@request.session` is an `ActionDispatch::Request::Session` object now (whereas in 3.x it was an `Rack::Session::Abstract::SessionHash` object).

It seems that calling `PP.pp(@request.session, "")` in Rails 4.0 now outputs something like this:

#

Instead of the following (which is what Rails 3.x output):

{"session_id"=>"c358e974d2640f3100ae83f7f8a50020", "user_id"=>5}

Explicitly converting the `@request.session` object to a hash appears to work both in 3.x and 4.x. Unfortunately, I couldn't find a way to write a test for this, as Rails' test framework uses an `ActionController:TestSession` object to manage sessions, which doesn't exhibit the same issue that the new `ActionDispatch::Request::Session` object does. If anyone has some input on how to properly test this, let me know.