domain_switcher 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/domain_switcher/cookie.rb +18 -3
- data/lib/domain_switcher/middleware.rb +1 -1
- metadata +4 -4
@@ -1,9 +1,24 @@
|
|
1
1
|
module DomainSwitcher
|
2
2
|
module Cookie
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
# Return sessions current session_stores
|
5
|
+
# Warning this it not thread safe for now !
|
6
|
+
# Only works with Rails 3 and Memcached session
|
7
|
+
def self.session_stores
|
8
|
+
return @session_stores if @session_stores
|
9
|
+
@session_stores = nil
|
10
|
+
ObjectSpace.each_object(ActionDispatch::Session::MemCacheStore) do |o|
|
11
|
+
@session_stores = o
|
12
|
+
end
|
13
|
+
return @session_stores
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.switch(domain)
|
17
|
+
if o = session_stores
|
18
|
+
default_options = o.instance_variable_get(:@default_options)
|
19
|
+
default_options.update(:domain => domain.cookie_domain)
|
20
|
+
o.instance_variable_set(:@default_options, default_options)
|
21
|
+
end
|
7
22
|
end
|
8
23
|
|
9
24
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domain_switcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Guillaume Luccisano
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-04-21 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|