saasable 4.0.1 → 4.0.2
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/saasable/errors.rb +1 -0
- data/lib/saasable/mongoid/saas_document.rb +12 -4
- data/lib/saasable/mongoid/scoped_document.rb +1 -1
- data/saasable.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dad7c49704bb790278241fcb9867b97e72ced7b4
|
4
|
+
data.tar.gz: 9163ab17a1a41437c6634ed917c742ae6f297700
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1926b99934abdcae4e9c5b432f9c98fde1599d0ad223e66aa4a43f78df7b1dea4443ebd60418187108d9bdef48719f8fc8652a4dfd9ba5db7833a443646cc992
|
7
|
+
data.tar.gz: 752bf47c660c1d26a3fbfed9a0c681e738fe62dad60a125f4d2bb0ac10d1bd4d7e0f30cd508c130a2d3e76dee102ba8820479e7f7c3332ee25f275a9942ceb80
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.0.
|
1
|
+
4.0.2
|
data/lib/saasable/errors.rb
CHANGED
@@ -64,13 +64,21 @@ module Saasable::Mongoid::SaasDocument
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def find_by_host! a_host
|
67
|
-
|
67
|
+
if Saasable::Mongoid::SaasDocument.saas_document.nil?
|
68
|
+
if Rails.env.production?
|
69
|
+
raise Saasable::Errors::NoSaasDocuments, "you need to set one Saasable::SaasDocument"
|
70
|
+
else
|
71
|
+
return nil
|
72
|
+
end
|
73
|
+
end
|
68
74
|
|
69
|
-
|
70
|
-
if
|
75
|
+
possible_saas = Saasable::Mongoid::SaasDocument.saas_document.where(:hosts => a_host).to_a
|
76
|
+
if possible_saas.empty?
|
71
77
|
raise Saasable::Errors::SaasNotFound, "no #{Saasable::Mongoid::SaasDocument.saas_document.name} found for the host: \"#{a_host}\""
|
78
|
+
elsif possible_saas.count > 1
|
79
|
+
raise Saasable::Errors::MultipleSaasFound, "more then 1 #{Saasable::Mongoid::SaasDocument.saas_document.name} found for the host: \"#{a_host}\""
|
72
80
|
else
|
73
|
-
return
|
81
|
+
return possible_saas.first
|
74
82
|
end
|
75
83
|
end
|
76
84
|
|
@@ -41,7 +41,7 @@ module Saasable::Mongoid::ScopedDocument
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def index_with_saasable(spec, options = nil)
|
44
|
-
index_without_saasable(spec, options.
|
44
|
+
index_without_saasable(spec, options.merge({unique: false}))
|
45
45
|
index_without_saasable({saas_id: 1}.merge(spec), options) unless spec.include?(:saas_id)
|
46
46
|
end
|
47
47
|
end
|
data/saasable.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: saasable 4.0.
|
5
|
+
# stub: saasable 4.0.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "saasable"
|
9
|
-
s.version = "4.0.
|
9
|
+
s.version = "4.0.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|