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.

verify always loads session

#2427

Scince Rails 2.3 the session is lazy loaded the first time it is accessed.

The verify instruction in Rails 2.3.2 is accessing always accessing the session, even if the user does not specify any session relevant options.

Consider the following example:


class TestController < ApplicationController
  verify :params => 'one'

  def index
    render :nothing
  end
end

As there is no reference to the session, it should not be loaded if the index action is called. However the current implementation of verify will access a session with a key of nil.

The attached patch prevents this access and therefore prevents the unneeded loading of the current session. A small addition in ActionController::TestSession will raise an exception if someone tries to read the nil key from it. I think this is the easiest way to test this behaviour.

This is my first contribution, as such I'd appreciate any feedback. Would it be possible to integrate this patch in the next 2.3 release?

Reported by Andreas Gerauer · April 5th, 2009 @ 11:20 PM

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

Activity

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

    May 4th, 2010 @ 06:48 PM

  2. Surendra Singhi
    Surendra Singhi

    +1 for this patch. This is an annoying problem.

    May 26th, 2010 @ 07:39 PM

  3. Surendra Singhi
    Surendra Singhi
    • Tag changed from 2.3.2, bug, load, patch, session, verify to 2.3.x, bug, load, patch, session, verify

    May 26th, 2010 @ 07:42 PM

  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open
    • Tag changed from 2.3.x, bug, load, patch, session, verify to 23x, bug, load, patch, session, verify
    • Importance changed from to

    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:52 PM

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

    February 2nd, 2011 @ 04:52 PM