public
Description: A Ruby web application framework
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack.git
Click here to lend your support to: mack and make a donation at www.pledgie.com !
Fixed sessions only working with 'local_memory' mode [#97 state:resolved]
markbates (author)
Mon Aug 18 08:54:01 -0700 2008
commit  a2b00a457148102471750494cd00a4eca29f1f59
tree    23ff2513c9fd14c6b62a1f12b2c3d3df8c2b3718
parent  a46eceb7316d86a802efe21e97339522cd70205f
...
1
 
2
3
4
...
1
2
3
4
5
0
@@ -1,4 +1,5 @@
0
 * [#101] Update to file upload testing (build_file -> file_for_upload, and multipart support in put)
0
+* [#97] Fixed sessions only working with 'local_memory' mode
0
 * [#96] Distributed Views module now uses file cache
0
 * [#92] Removed deprecated app_config.orm code.
0
 * [#91] Fixed Mack blowing up if there is no config/initializers/gems.rb file.
...
30
31
32
 
 
 
 
 
33
34
35
...
30
31
32
33
34
35
36
37
38
39
40
0
@@ -30,6 +30,11 @@ module Mack
0
       @sess_hash = {}
0
     end
0
     
0
+    # Deletes a value from the session
0
+    def delete(key)
0
+      @sess_hash.delete(key.to_sym)
0
+    end
0
+    
0
     private
0
     attr_reader :sess_hash # :nodoc:
0
     
...
7
8
9
10
11
12
 
 
 
13
14
 
15
16
17
18
19
 
20
21
22
...
24
25
26
27
 
28
29
 
30
31
32
...
7
8
9
 
 
 
10
11
12
13
 
14
15
16
17
18
 
19
20
21
22
...
24
25
26
 
27
28
 
29
30
31
32
0
@@ -7,16 +7,16 @@ module Mack
0
       
0
       def start(request, response, cookies)
0
         if app_config.mack.use_sessions
0
-          sess_id = retrieve_session_id(request, response, cookies)
0
-          unless sess_id
0
-            sess_id = create_new_session(request, response, cookies)
0
+          self.sess_id = retrieve_session_id(request, response, cookies)
0
+          unless self.sess_id
0
+            self.sess_id = create_new_session(request, response, cookies)
0
           else
0
-            sess = Cachetastic::Caches::MackSessionCache.get(sess_id)
0
+            sess = Cachetastic::Caches::MackSessionCache.get(self.sess_id)
0
             if sess
0
               request.session = sess
0
             else
0
               # we couldn't find it in the store, so we need to create it:
0
-              sess_id = create_new_session(request, response, cookies)
0
+              self.sess_id = create_new_session(request, response, cookies)
0
             end
0
           end
0
         end
0
@@ -24,9 +24,9 @@ module Mack
0
       
0
       def complete(request, response, cookies)
0
         unless response.redirection?
0
-          request.session[:tell] = nil
0
+          request.session.delete(:tell)
0
         end
0
-        Cachetastic::Caches::MackSessionCache.set(sess_id, request.session) if app_config.mack.use_sessions
0
+        Cachetastic::Caches::MackSessionCache.set(self.sess_id, request.session) if app_config.mack.use_sessions
0
       end
0
       
0
       private

Comments