couchrest_session_store 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -0
- data/lib/couchrest_session_store.rb +9 -1
- metadata +34 -2
data/Rakefile
CHANGED
@@ -87,13 +87,21 @@ class CouchRestSessionStore < ActionDispatch::Session::AbstractStore
|
|
87
87
|
def build_or_update_doc(sid, session, marshal_data)
|
88
88
|
marshal_data = true if marshal_data.nil?
|
89
89
|
doc = secure_get(sid)
|
90
|
-
doc
|
90
|
+
update_doc doc, data_for_doc(session, marshal_data)
|
91
91
|
return doc
|
92
92
|
rescue RestClient::ResourceNotFound
|
93
93
|
data = data_for_doc(session, marshal_data).merge({"_id" => sid})
|
94
94
|
return CouchRest::Document.new(data)
|
95
95
|
end
|
96
96
|
|
97
|
+
def update_doc(doc, data)
|
98
|
+
# clean up old data but leave id and revision intact
|
99
|
+
doc.reject! do |k,v|
|
100
|
+
k[0] != '_'
|
101
|
+
end
|
102
|
+
doc.merge! data
|
103
|
+
end
|
104
|
+
|
97
105
|
def data_for_doc(session, marshal_data)
|
98
106
|
if marshal_data
|
99
107
|
{ "data" => self.class.marshal(session) }
|
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.1.
|
4
|
+
version: 0.1.3
|
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: 2013-07-
|
12
|
+
date: 2013-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: couchrest
|
@@ -59,6 +59,38 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: minitest
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
62
94
|
description: A Rails Session Store based on CouchRest Model
|
63
95
|
email:
|
64
96
|
- azul@leap.se
|