This project is archived and is in readonly mode.

#2427 ✓stale
Andreas Gerauer

verify always loads session

Reported by Andreas Gerauer | April 5th, 2009 @ 11:20 PM | in 3.x

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?

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages