domain_switcher 0.1.7 → 0.1.8

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.
@@ -1,24 +1,9 @@
1
1
  module DomainSwitcher
2
2
  module Cookie
3
3
 
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
4
+ def self.switch(domain, env)
5
+ env['rack.session.options'].update(:domain => domain.cookie_domain)
6
+ env
22
7
  end
23
8
 
24
9
  end
@@ -19,7 +19,7 @@ module DomainSwitcher
19
19
  Thread.current[:domain_switcher_website] = domain.website
20
20
 
21
21
  DomainSwitcher::Cache::switch(domain.website)
22
- DomainSwitcher::Cookie::switch(domain)
22
+ env = DomainSwitcher::Cookie::switch(domain, env)
23
23
  end
24
24
 
25
25
  @app.call(env)
@@ -9,4 +9,5 @@ end
9
9
 
10
10
  ActionController::Base.send :include, DomainSwitcher::Helper
11
11
  ActiveRecord::Base.send :include, DomainSwitcher::Helper
12
- ActionView::Base.send :include, DomainSwitcher::Helper
12
+ ActionView::Base.send :include, DomainSwitcher::Helper
13
+ ActionView::Resolver.send :include, DomainSwitcher::Helper
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: domain_switcher
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 7
10
- version: 0.1.7
5
+ version: 0.1.8
11
6
  platform: ruby
12
7
  authors:
13
8
  - Guillaume Luccisano
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-04-21 00:00:00 -07:00
13
+ date: 2011-05-03 00:00:00 -07:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,11 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 19
30
- segments:
31
- - 1
32
- - 1
33
- - 0
34
24
  version: 1.1.0
35
25
  type: :runtime
36
26
  version_requirements: *id001
@@ -80,25 +70,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
70
  requirements:
81
71
  - - ">="
82
72
  - !ruby/object:Gem::Version
83
- hash: 3
84
- segments:
85
- - 0
86
73
  version: "0"
87
74
  required_rubygems_version: !ruby/object:Gem::Requirement
88
75
  none: false
89
76
  requirements:
90
77
  - - ">="
91
78
  - !ruby/object:Gem::Version
92
- hash: 19
93
- segments:
94
- - 1
95
- - 3
96
- - 4
97
79
  version: 1.3.4
98
80
  requirements: []
99
81
 
100
82
  rubyforge_project: domain_switcher
101
- rubygems_version: 1.4.2
83
+ rubygems_version: 1.6.2
102
84
  signing_key:
103
85
  specification_version: 3
104
86
  summary: Rack based domain switcher with configuration