Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

local error page does not show session

#2727

In rails 2.3.2 the local error page always shows '---' as the session.

I think the error is in
rails / actionpack / lib / action_controller / templates / rescues / _request_and_response.erb

where the session still is expected to contain a data instance variable:

<%= debug(request.session.instance_variable_get("@data")) %>

The same problem exists in the exception_notification plugin.

Reported by Morus Walter · May 27th, 2009 @ 02:17 PM

State: stale
Milestone: 3.x
Assigned to: nobody
Importance: none

Activity

  1. Morus Walter
    Morus Walter
    • Tag set to 2-3-stable, exception_notification, session

    May 27th, 2009 @ 02:18 PM

  2. Laurent Farcy
    Laurent Farcy

    I fixed a similar issue with the exception_notification plugin by replacing

    • session id: <%= @request.session.instance_variable_get(:@session_id).inspect %>
    • data: <%= PP.pp(@request.session.instance_variable_get(:@data),"").gsub(/\n/, "\n ").strip %>

    by

    • session id: <%= @request.session_options[:id].inspect %>
    • data: <%= PP.pp(@request.session.to_hash,"").gsub(/\n/, "\n ").strip %>

    in the exception_notification/views/exception_notifier/_session.rhtml file.

    July 22nd, 2009 @ 03:27 PM

  3. Gabe da Silveira
    Gabe da Silveira
    • Tag changed from 2-3-stable, exception_notification, session to 2-3-stable, 3.0, exception_notification, session

    I've created a patch for 2-3-stable and tested on my 2.3.4 app. I rebased to master as well. There are no tests because testing the output of this template seems too granular, but I'm open to suggestions on a good way to test it if necessary. My instinct is that it should just be fixed.

    October 10th, 2009 @ 12:41 AM

  4. Brian Kaney
  5. Tim Connor
    Tim Connor
    • Tag changed from 2-3-stable, 3.0, exception_notification, session to 2-3-stable, 3.0, session

    This should be fixed in ExceptionNotifiable (http://github.com/rails/exception_notification), for 3.0 and 2.3 branches, actually via a couple other refactors. Please re-tag and add the appropriate details, if you find that not to be the case.

    Or add a ticket in the Rails plugin project: https://rails.lighthouseapp.com/projects/8995

    April 2nd, 2010 @ 08:41 AM

  6. Roland Moriz
    Roland Moriz

    I can confirm the original bug is still present in Rails 2.3.5 / actionpack

    April 11th, 2010 @ 05:30 AM

  7. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  8. David Trasbo
    David Trasbo
    • State changed from new to incomplete
    • Importance changed from to

    I was unable to reproduce this with edge Rails:

    $ script/rails g controller fails index
          create  app/controllers/fails_controller.rb
           route  get "fails/index"
          invoke  erb
          create    app/views/fails
          create    app/views/fails/index.html.erb
          invoke  test_unit
          create    test/functional/fails_controller_test.rb
          invoke  helper
          create    app/helpers/fails_helper.rb
          invoke    test_unit
          create      test/unit/helpers/fails_helper_test.rb
    

    routes.rb:

    Ticket2727::Application.routes.draw do
      resources :fails
    end
    

    app/controllers/fails_controller.rb:

    class FailsController < ApplicationController
      def index
        session[:foo] = 'bar'
        raise 'fail!'
      end
    end
    

    The error page on http://localhost:3000/fails shows this session dump:

    foo: "bar"
    session_id: "814bfd9248f48b0c965552e06d63b81b"
    

    However, I was I able to reproduce this using the 2-3-stable branch:

    $ script/generate controller fails index
          exists  app/controllers/
          exists  app/helpers/
          create  app/views/fails
          exists  test/functional/
          create  test/unit/helpers/
          create  app/controllers/fails_controller.rb
          create  test/functional/fails_controller_test.rb
          create  app/helpers/fails_helper.rb
          create  test/unit/helpers/fails_helper_test.rb
          create  app/views/fails/index.html.erb
    

    routes.rb:

    ActionController::Routing::Routes.draw do |map|
      map.resources :fails
    end
    

    app/controllers/fails_controller.rb:

    class FailsController < ApplicationController
      def index
        session[:foo] = 'bar'
        raise 'fail!'
      end
    end
    

    The error page shows --- as session dump, as described.

    Please provide a patch (https://rails.lighthouseapp.com/projects/8994/sending-patches) with a fix and/or a failing test.

    October 19th, 2010 @ 10:37 AM

  9. Santiago Pastorino
    Santiago Pastorino
    • State changed from incomplete to open
    • Tag changed from 2-3-stable, 3.0, session to 2-3-stable, 30, session

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:47 PM

  10. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:47 PM