couchrest_session_store 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/couchrest_session_store.rb +15 -0
- metadata +18 -2
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'couchrest'
|
2
2
|
require 'couchrest_model'
|
3
|
+
require 'action_dispatch'
|
3
4
|
|
4
5
|
# CouchDB session storage for Rails.
|
5
6
|
#
|
@@ -52,6 +53,9 @@ class CouchRestSessionStore < ActionDispatch::Session::AbstractStore
|
|
52
53
|
database.save_doc(doc)
|
53
54
|
end
|
54
55
|
return [sid, session]
|
56
|
+
rescue RestClient::ResourceNotFound
|
57
|
+
# session does not exist anymore - create a new one
|
58
|
+
get_session(env, nil)
|
55
59
|
end
|
56
60
|
|
57
61
|
def set_session(env, sid, session, options)
|
@@ -60,5 +64,16 @@ class CouchRestSessionStore < ActionDispatch::Session::AbstractStore
|
|
60
64
|
database.save_doc(doc)
|
61
65
|
return sid
|
62
66
|
end
|
67
|
+
|
68
|
+
def destroy_session(env, sid, options)
|
69
|
+
doc = database.get(sid)
|
70
|
+
database.delete_doc(doc)
|
71
|
+
return nil
|
72
|
+
rescue RestClient::ResourceNotFound
|
73
|
+
# already destroyed - we're done.
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
|
63
78
|
end
|
64
79
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchrest_session_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: couchrest
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: actionpack
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
description: A Rails Session Store based on CouchRest Model
|
47
63
|
email:
|
48
64
|
- azul@leap.se
|