multitenant 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7febabe4ffdb00857b82fc1a420626f69f8b2e22
4
+ data.tar.gz: 7abe0b49276cbd7a93ee897f6d8ae0501dc60908
5
+ SHA512:
6
+ metadata.gz: cdd00f2d57d275367f311219baf2dbc60fcdebe8e0a3478a72a926e87f821684a3bc1d5103f527afd401eb121bdb2b48e2146cb2888306ec49602ba1751fecaf
7
+ data.tar.gz: 0129580a641dbca6fb0b50dc96c64f633ffd369e669803e1429c7fc8ff8c6b95448981524a1d852616ddedb13a486f3a54115165a06c4d85cbc11df8c8887966
@@ -0,0 +1 @@
1
+ 2.1.5
@@ -0,0 +1 @@
1
+ language: ruby
@@ -0,0 +1,57 @@
1
+ [![Build Status](https://travis-ci.org/wireframe/multitenant.png?branch=master)](https://travis-ci.org/wireframe/multitenant)
2
+
3
+ # Multitenant
4
+
5
+ When building multitenant applications, never let an unscoped Model.all
6
+ accidentally leak data to an unintended audience.
7
+
8
+ ## Usage
9
+
10
+ ```ruby
11
+ class User < ActiveRecord::Base
12
+ belongs_to :tenant
13
+ belongs_to_multitenant
14
+ end
15
+
16
+ Multitenant.with_tenant current_tenant do
17
+ # queries within this block are automatically
18
+ # scoped to the current tenant
19
+ User.all
20
+
21
+ # new objects created within this block are automatically
22
+ # assigned to the current tenant
23
+ User.create :name => 'Bob'
24
+ end
25
+ ```
26
+
27
+ ## Features
28
+
29
+ * Rails 3 compatible
30
+ * Restrict database queries to only lookup objects for the current tenant
31
+ * Auto assign newly created objects to the current tenant
32
+
33
+
34
+ ## Contributing
35
+
36
+ * Check out the latest master to make sure the feature hasn't been
37
+ implemented or the bug hasn't been fixed yet
38
+ * Check out the issue tracker to make sure someone already hasn't requested
39
+ it and/or contributed it
40
+ * Fork the project
41
+ * Start a feature/bugfix branch
42
+ * Commit and push until you are happy with your contribution
43
+ * Make sure to add tests for it. This is important so I don't break it in a
44
+ future version unintentionally.
45
+ * Please try not to mess with the Rakefile, version, or history. If you want
46
+ to have your own version, or is otherwise necessary, that is fine, but
47
+ please isolate to its own commit so I can cherry-pick around it.
48
+
49
+
50
+ ## Credits
51
+
52
+ Thanks to Lars Klevan for inspiring this project.
53
+
54
+ ## Copyright
55
+
56
+ Copyright (c) 2011 Ryan Sonnek. See LICENSE.txt for further details.
57
+
@@ -21,8 +21,7 @@ module Multitenant
21
21
  def belongs_to_multitenant(association = :tenant)
22
22
  reflection = reflect_on_association association
23
23
  before_validation Proc.new {|m|
24
- return unless Multitenant.current_tenant
25
- m.send "#{association}=".to_sym, Multitenant.current_tenant
24
+ m.send("#{association}=".to_sym, Multitenant.current_tenant) if Multitenant.current_tenant
26
25
  }, :on => :create
27
26
  default_scope lambda {
28
27
  where({reflection.foreign_key => Multitenant.current_tenant.id}) if Multitenant.current_tenant
@@ -1,3 +1,3 @@
1
1
  module Multitenant
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -15,9 +15,11 @@ Gem::Specification.new do |s|
15
15
  s.rubyforge_project = "multitenant"
16
16
 
17
17
  s.add_dependency(%q<activerecord>, ['>= 3.1'])
18
- s.add_development_dependency(%q<sqlite3>, ["~> 1.3.3"])
19
- s.add_development_dependency(%q<rspec>, ['~> 2.6.0'])
20
- s.add_development_dependency(%q<rspec-core>, ['~> 2.6.4'])
18
+
19
+ s.add_development_dependency('rake')
20
+ s.add_development_dependency('sqlite3', ["~> 1.3.3"])
21
+ s.add_development_dependency('rspec', ['~> 2.6.0'])
22
+ s.add_development_dependency('rspec-core', ['~> 2.6.4'])
21
23
 
22
24
  s.files = `git ls-files`.split("\n")
23
25
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,102 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: multitenant
3
- version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 0
10
- version: 0.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.1
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Ryan Sonnek
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-08-31 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2014-12-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: activerecord
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
26
17
  - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 5
29
- segments:
30
- - 3
31
- - 1
32
- version: "3.1"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
33
20
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: sqlite3
37
21
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 29
44
- segments:
45
- - 1
46
- - 3
47
- - 3
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
48
47
  version: 1.3.3
49
48
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: rspec
53
49
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 23
60
- segments:
61
- - 2
62
- - 6
63
- - 0
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
64
61
  version: 2.6.0
65
62
  type: :development
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: rspec-core
69
63
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
73
- - - ~>
74
- - !ruby/object:Gem::Version
75
- hash: 31
76
- segments:
77
- - 2
78
- - 6
79
- - 4
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.6.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-core
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
80
75
  version: 2.6.4
81
76
  type: :development
82
- version_requirements: *id004
83
- description: never let an unscoped Model.all accidentally leak data to an unintended audience.
84
- email:
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.6.4
83
+ description: never let an unscoped Model.all accidentally leak data to an unintended
84
+ audience.
85
+ email:
85
86
  - ryan@codecrate.com
86
87
  executables: []
87
-
88
88
  extensions: []
89
-
90
89
  extra_rdoc_files: []
91
-
92
- files:
93
- - .document
94
- - .gitignore
95
- - .rspec
96
- - .rvmrc
90
+ files:
91
+ - ".document"
92
+ - ".gitignore"
93
+ - ".rspec"
94
+ - ".ruby-version"
95
+ - ".travis.yml"
97
96
  - Gemfile
98
97
  - LICENSE.txt
99
- - README.rdoc
98
+ - README.md
100
99
  - Rakefile
101
100
  - lib/multitenant.rb
102
101
  - lib/multitenant/version.rb
@@ -106,38 +105,28 @@ files:
106
105
  - spec/spec_helper.rb
107
106
  homepage: http://github.com/wireframe/multitenant
108
107
  licenses: []
109
-
108
+ metadata: {}
110
109
  post_install_message:
111
110
  rdoc_options: []
112
-
113
- require_paths:
111
+ require_paths:
114
112
  - lib
115
- required_ruby_version: !ruby/object:Gem::Requirement
116
- none: false
117
- requirements:
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
118
115
  - - ">="
119
- - !ruby/object:Gem::Version
120
- hash: 3
121
- segments:
122
- - 0
123
- version: "0"
124
- required_rubygems_version: !ruby/object:Gem::Requirement
125
- none: false
126
- requirements:
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
127
120
  - - ">="
128
- - !ruby/object:Gem::Version
129
- hash: 3
130
- segments:
131
- - 0
132
- version: "0"
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
133
123
  requirements: []
134
-
135
124
  rubyforge_project: multitenant
136
- rubygems_version: 1.8.5
125
+ rubygems_version: 2.2.2
137
126
  signing_key:
138
- specification_version: 3
127
+ specification_version: 4
139
128
  summary: scope database queries to current tenant
140
- test_files:
129
+ test_files:
141
130
  - spec/database.yml
142
131
  - spec/multitenant_spec.rb
143
132
  - spec/spec_helper.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use ree-1.8.7-2011.03@multitenant --create
@@ -1,46 +0,0 @@
1
- = Multitenant
2
-
3
- When building multitenant applications, never let an unscoped Model.all accidentally leak data to an unintended audience.
4
-
5
- == Usage
6
-
7
- class User < ActiveRecord::Base
8
- belongs_to :tenant
9
- belongs_to_multitenant
10
- end
11
-
12
- Multitenant.with_tenant current_tenant do
13
- # queries within this block are automatically
14
- # scoped to the current tenant
15
- User.all
16
-
17
- # new objects created within this block are automatically
18
- # assigned to the current tenant
19
- User.create :name => 'Bob'
20
- end
21
-
22
- == Features
23
-
24
- * Rails 3 compatible
25
- * Restrict database queries to only lookup objects for the current tenant
26
- * Auto assign newly created objects to the current tenant
27
-
28
- == Contributing
29
-
30
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
31
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
32
- * Fork the project
33
- * Start a feature/bugfix branch
34
- * Commit and push until you are happy with your contribution
35
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
36
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
37
-
38
- == Credits
39
-
40
- Lars Klevan for inspiring this project.
41
-
42
- == Copyright
43
-
44
- Copyright (c) 2011 Ryan Sonnek. See LICENSE.txt for
45
- further details.
46
-