This project is archived and is in readonly mode.
Rails3 rc env['rack.session.record'] is not initialized in first request
Reported by Daniele Orlandi | July 28th, 2010 @ 05:59 PM
When creating a new session (by accessing the SessionHash), load_session in AbstractStore is not calling get_session anymore (between beta4 and rc), thus the ActiveRecord session record is not instantiated and env['rack.session.record'] is empty.
This is the relevant code in ./actionpack-3.0.0.rc/lib/action_dispatch/middleware/session/abstract_store.rb
def load_session(env)
stale_session_check! do
if sid = current_session_id(env)
sid, session = get_session(env, sid)
else
sid, session = generate_sid, {}
end
[sid, session]
end
end
Since my session record is a complex model which also implements session-specific behavior I need to access it even if it is a new session.
I see that this change has been made on purpose to lazy-create the record, however it breaks my usage of sessions and I don't see an alternative approach to have a session model (and not only a hash) in my application without duplicating session tables.
Comments and changes to this ticket
-
Daniele Orlandi July 28th, 2010 @ 06:11 PM
Sorry, title has been truncated.... should have read "Rails3 rc env['rack.session.record'] is not initialized in first request"
Can you edit it?
-
Rohit Arondekar July 29th, 2010 @ 02:49 AM
- Title changed from Rails3 rc to Rails3 rc env['rack.session.record'] is not initialized in first request
- Importance changed from to Low
-
Santiago Pastorino February 2nd, 2011 @ 04:34 PM
- State changed from new to open
- Tag changed from abstract_store.rb, rails3.0rc, rails3rc, session to abstract_storerb, rails30rc, rails3rc, 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.
-
Santiago Pastorino February 2nd, 2011 @ 04:34 PM
- State changed from open to stale
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
Referenced by
- 5237 rack.session.record too lazy This is duplication of https://rails.lighthouseapp.com/p...