company_scope 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/company_scope/railtie.rb +9 -8
- data/lib/company_scope/version.rb +1 -1
- data/log/test.log +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c980a4acc86a05a0a90934da1b8b9e53fc3b1d90
|
4
|
+
data.tar.gz: de6d8e76cdb5876b5c469cdfe7814a2b3e92e15c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbd4f6e1aac79bbeb431ccd31b84ec4c394d7a0c01b791308be24ed9cf87fbcb8bafeda067a53169dc15d8101460bcf25c7edaec40fef50bccbe3786a5766442
|
7
|
+
data.tar.gz: 225c8f51f4fedf4076dcf2f90ee8e315f13f5996917b1275ae1fe7a089b48483bb876f83612488d980e9ffe442dddf331a5625d3ad30157079eab3155c834ffd
|
data/README.md
CHANGED
@@ -81,7 +81,7 @@ the company name as a string as:
|
|
81
81
|
|
82
82
|
```ruby
|
83
83
|
class MyCustomDomainMatcher
|
84
|
-
def to_domain(request)
|
84
|
+
def self.to_domain(request)
|
85
85
|
.... my custom logic to extrapoulate the company name
|
86
86
|
company_name # the return value must be the company_name as a string.
|
87
87
|
end
|
@@ -5,25 +5,25 @@ module CompanyScope
|
|
5
5
|
config.company_scope = ActiveSupport::OrderedOptions.new
|
6
6
|
#
|
7
7
|
initializer :after_initialize do |app|
|
8
|
-
|
8
|
+
#
|
9
9
|
CompanyScope.configure do |config|
|
10
10
|
config.company_model = app.config.company_scope[:company_model] || :company
|
11
11
|
config.company_name_matcher = app.config.company_scope[:company_name_matcher] || :subdomain_matcher
|
12
12
|
end
|
13
|
-
|
13
|
+
#
|
14
14
|
company_config = CompanyScope.config.company_model
|
15
15
|
company_name_matcher = CompanyScope.config.company_name_matcher
|
16
|
-
|
16
|
+
#
|
17
17
|
# - add MultiCompany Rack middleware to detect the company_name from the subdomain
|
18
|
-
app.config.middleware.insert_after Rack::Sendfile, Custom::MultiCompany, company_config, company_name_matcher
|
19
|
-
|
18
|
+
#app.config.middleware.insert_after Rack::Sendfile, Custom::MultiCompany, company_config, company_name_matcher
|
19
|
+
app.config.middleware.insert_before ActionDispatch::Static, Custom::MultiCompany, company_config, company_name_matcher
|
20
20
|
# - the base module injects the default scope into company dependant models
|
21
|
+
#
|
21
22
|
ActiveRecord::Base.send(:include, CompanyScope::Base)
|
22
|
-
|
23
|
+
#
|
23
24
|
# - the company_entity module injects class methods for acting as the company!
|
24
25
|
ActiveRecord::Base.send(:include, CompanyScope::Guardian)
|
25
|
-
|
26
|
-
|
26
|
+
#
|
27
27
|
if defined?(ActionController::Base)
|
28
28
|
# - the control module has some error handling for the application controller
|
29
29
|
ActionController::Base.send(:include, CompanyScope::Control)
|
@@ -31,6 +31,7 @@ module CompanyScope
|
|
31
31
|
# - actions in the controller are wrapped
|
32
32
|
ActionController::Base.send(:include, CompanyScope::Filter)
|
33
33
|
end
|
34
|
+
|
34
35
|
# - if this is being used in an API..
|
35
36
|
if defined?(ActionController::API)
|
36
37
|
# - the control module has some error handling for the application controller
|
data/log/test.log
CHANGED
@@ -334,3 +334,11 @@ Processing by DummyApplicationController#index as HTML
|
|
334
334
|
Completed 200 OK in 0ms (Views: 0.2ms)
|
335
335
|
Processing by DummyApplicationController#index as HTML
|
336
336
|
Completed 500 Internal Server Error in 0ms
|
337
|
+
Processing by DummyApplicationController#index as HTML
|
338
|
+
Completed 200 OK in 0ms (Views: 0.2ms)
|
339
|
+
Processing by DummyApplicationController#index as HTML
|
340
|
+
Completed 200 OK in 0ms (Views: 0.1ms)
|
341
|
+
Processing by DummyApplicationController#index as HTML
|
342
|
+
Completed 200 OK in 0ms (Views: 0.1ms)
|
343
|
+
Processing by DummyApplicationController#index as HTML
|
344
|
+
Completed 500 Internal Server Error in 0ms
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: company_scope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Forkin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|