Skip to content
This repository

Add find and set methods to Session object #502

Merged
merged 1 commit into from about 1 year ago

2 participants

Santiago Pastorino James Tucker
Santiago Pastorino
Collaborator

With this we can completely reuse Rack session object from Rails.
See https://github.com/spastorino/rails/blob/rack_15/actionpack/lib/action_dispatch/request/session.rb#L10-16

Backport to rack-1.5

/cc @raggi

James Tucker raggi merged commit b6fd5bd into from February 05, 2013
James Tucker raggi closed this February 05, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 29, 2013
Santiago Pastorino Add find and set methods to Session object 49b2f25
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 8 additions and 0 deletions. Show diff stats Hide diff stats

  1. 8  lib/rack/session/abstract/id.rb
8  lib/rack/session/abstract/id.rb
@@ -24,6 +24,14 @@ class SessionHash
24 24
         include Enumerable
25 25
         attr_writer :id
26 26
 
  27
+        def self.find(env)
  28
+          env[ENV_SESSION_KEY]
  29
+        end
  30
+
  31
+        def self.set(env, session)
  32
+          env[ENV_SESSION_KEY] = session
  33
+        end
  34
+
27 35
         def self.set_options(env, options)
28 36
           env[ENV_SESSION_OPTIONS_KEY] = options.dup
29 37
         end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.