acts_as_tenant 0.2.5 → 0.2.6
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.
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
0.2.6
|
2
|
+
-----
|
3
|
+
* Fixed a bug with resolving the tenant model name (thx devton!)
|
4
|
+
* Added support for using relations: User.create(:account => Account.first) now works, while it wouldn't before (thx bnmrrs)
|
5
|
+
|
1
6
|
0.2.5
|
2
7
|
-----
|
3
|
-
* Added Rails 3.2 compatibility
|
8
|
+
* Added Rails 3.2 compatibility (thx nickveys!)
|
4
9
|
|
5
10
|
0.2.4
|
6
11
|
-----
|
@@ -53,15 +53,15 @@ module ActsAsTenant
|
|
53
53
|
if new_record?
|
54
54
|
write_attribute(fkey, integer)
|
55
55
|
else
|
56
|
-
raise "#{fkey} is immutable!"
|
56
|
+
raise "#{fkey} is immutable! [ActsAsTenant]"
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
define_method "#{association}=" do |model|
|
61
61
|
if new_record?
|
62
|
-
|
62
|
+
super(model)
|
63
63
|
else
|
64
|
-
raise "#{association} is immutable!"
|
64
|
+
raise "#{association} is immutable! [ActsAsTenant]"
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -76,14 +76,14 @@ module ActsAsTenant
|
|
76
76
|
validates_each a.foreign_key.to_sym do |record, attr, value|
|
77
77
|
# Invalidate the association unless the parent is known to the tenant or no association has
|
78
78
|
# been set.
|
79
|
-
record.errors.add attr, "is invalid
|
79
|
+
record.errors.add attr, "is invalid [ActsAsTenant]" unless value.nil? || association_class.where(:id => value).present?
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
def validates_uniqueness_to_tenant(fields, args ={})
|
86
|
-
raise "ActsAsTenant
|
86
|
+
raise "[ActsAsTenant] validates_uniqueness_to_tenant: no current tenant" unless respond_to?(:is_scoped_by_tenant?)
|
87
87
|
tenant_id = lambda { "#{ActsAsTenant.tenant_class.to_s.downcase}_id"}.call
|
88
88
|
args[:scope].nil? ? args[:scope] = tenant_id : args[:scope] << tenant_id
|
89
89
|
validates_uniqueness_of(fields, args)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_tenant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
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: 2012-
|
12
|
+
date: 2012-02-09 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Integrates multi-tenancy into a Rails application in a convenient and
|
15
15
|
out-of-your way manner
|