milia 0.3.34 → 0.3.38
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/Gemfile +2 -2
- data/Gemfile.lock +48 -49
- data/README.md +52 -7
- data/VERSION +1 -1
- data/lib/milia/base.rb +17 -12
- data/milia.gemspec +9 -8
- data/test/rails_app/Gemfile +8 -6
- data/test/rails_app/Gemfile.lock +107 -101
- data/test/rails_app/Gemfile.lock.backup +167 -0
- data/test/rails_app/config/initializers/devise.rb +0 -4
- data/test/rails_app/config/routes.rb +1 -3
- data/test/rails_app/db/migrate/20111012050340_devise_create_users.rb +20 -9
- data/test/rails_app/db/schema.rb +22 -21
- data/test/rails_app/test/test_helper.rb +0 -5
- data/test/rails_app/test/unit/post_test.rb +4 -2
- data/test/rails_app/test/unit/tenant_test.rb +25 -4
- metadata +12 -11
data/Gemfile
CHANGED
|
@@ -3,14 +3,14 @@ source "http://rubygems.org"
|
|
|
3
3
|
# Example:
|
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
|
5
5
|
|
|
6
|
-
gem 'rails', '
|
|
6
|
+
gem 'rails', '3.2.13'
|
|
7
7
|
gem 'devise', "2.1.2"
|
|
8
8
|
|
|
9
9
|
# Add dependencies to develop your gem here.
|
|
10
10
|
# Include everything needed to run rake, tests, features, etc.
|
|
11
11
|
group :development, :test do
|
|
12
12
|
gem 'pg'
|
|
13
|
-
gem "shoulda", "
|
|
13
|
+
gem "shoulda", "3.5.0"
|
|
14
14
|
gem "jeweler", "~> 1.6.4"
|
|
15
15
|
gem 'rdoc'
|
|
16
16
|
gem 'turn', :require => false
|
data/Gemfile.lock
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
actionmailer (3.2.
|
|
5
|
-
actionpack (= 3.2.
|
|
6
|
-
mail (~> 2.
|
|
7
|
-
actionpack (3.2.
|
|
8
|
-
activemodel (= 3.2.
|
|
9
|
-
activesupport (= 3.2.
|
|
4
|
+
actionmailer (3.2.13)
|
|
5
|
+
actionpack (= 3.2.13)
|
|
6
|
+
mail (~> 2.5.3)
|
|
7
|
+
actionpack (3.2.13)
|
|
8
|
+
activemodel (= 3.2.13)
|
|
9
|
+
activesupport (= 3.2.13)
|
|
10
10
|
builder (~> 3.0.0)
|
|
11
11
|
erubis (~> 2.7.0)
|
|
12
12
|
journey (~> 1.0.4)
|
|
13
|
-
rack (~> 1.4.
|
|
13
|
+
rack (~> 1.4.5)
|
|
14
14
|
rack-cache (~> 1.2)
|
|
15
15
|
rack-test (~> 0.6.1)
|
|
16
16
|
sprockets (~> 2.2.1)
|
|
17
|
-
activemodel (3.2.
|
|
18
|
-
activesupport (= 3.2.
|
|
17
|
+
activemodel (3.2.13)
|
|
18
|
+
activesupport (= 3.2.13)
|
|
19
19
|
builder (~> 3.0.0)
|
|
20
|
-
activerecord (3.2.
|
|
21
|
-
activemodel (= 3.2.
|
|
22
|
-
activesupport (= 3.2.
|
|
20
|
+
activerecord (3.2.13)
|
|
21
|
+
activemodel (= 3.2.13)
|
|
22
|
+
activesupport (= 3.2.13)
|
|
23
23
|
arel (~> 3.0.2)
|
|
24
24
|
tzinfo (~> 0.3.29)
|
|
25
|
-
activeresource (3.2.
|
|
26
|
-
activemodel (= 3.2.
|
|
27
|
-
activesupport (= 3.2.
|
|
28
|
-
activesupport (3.2.
|
|
29
|
-
i18n (
|
|
25
|
+
activeresource (3.2.13)
|
|
26
|
+
activemodel (= 3.2.13)
|
|
27
|
+
activesupport (= 3.2.13)
|
|
28
|
+
activesupport (3.2.13)
|
|
29
|
+
i18n (= 0.6.1)
|
|
30
30
|
multi_json (~> 1.0)
|
|
31
31
|
ansi (1.4.3)
|
|
32
32
|
arel (3.0.2)
|
|
@@ -39,67 +39,66 @@ GEM
|
|
|
39
39
|
warden (~> 1.2.1)
|
|
40
40
|
erubis (2.7.0)
|
|
41
41
|
git (1.2.5)
|
|
42
|
-
hike (1.2.
|
|
42
|
+
hike (1.2.3)
|
|
43
43
|
i18n (0.6.1)
|
|
44
44
|
jeweler (1.6.4)
|
|
45
45
|
bundler (~> 1.0)
|
|
46
46
|
git (>= 1.2.5)
|
|
47
47
|
rake
|
|
48
48
|
journey (1.0.4)
|
|
49
|
-
json (1.
|
|
50
|
-
mail (2.
|
|
51
|
-
i18n (>= 0.4.0)
|
|
49
|
+
json (1.8.0)
|
|
50
|
+
mail (2.5.4)
|
|
52
51
|
mime-types (~> 1.16)
|
|
53
52
|
treetop (~> 1.4.8)
|
|
54
|
-
mime-types (1.
|
|
55
|
-
multi_json (1.
|
|
53
|
+
mime-types (1.23)
|
|
54
|
+
multi_json (1.7.6)
|
|
56
55
|
orm_adapter (0.4.0)
|
|
57
|
-
pg (0.
|
|
56
|
+
pg (0.15.1)
|
|
58
57
|
polyglot (0.3.3)
|
|
59
|
-
rack (1.4.
|
|
58
|
+
rack (1.4.5)
|
|
60
59
|
rack-cache (1.2)
|
|
61
60
|
rack (>= 0.4)
|
|
62
|
-
rack-ssl (1.3.
|
|
61
|
+
rack-ssl (1.3.3)
|
|
63
62
|
rack
|
|
64
63
|
rack-test (0.6.2)
|
|
65
64
|
rack (>= 1.0)
|
|
66
|
-
rails (3.2.
|
|
67
|
-
actionmailer (= 3.2.
|
|
68
|
-
actionpack (= 3.2.
|
|
69
|
-
activerecord (= 3.2.
|
|
70
|
-
activeresource (= 3.2.
|
|
71
|
-
activesupport (= 3.2.
|
|
65
|
+
rails (3.2.13)
|
|
66
|
+
actionmailer (= 3.2.13)
|
|
67
|
+
actionpack (= 3.2.13)
|
|
68
|
+
activerecord (= 3.2.13)
|
|
69
|
+
activeresource (= 3.2.13)
|
|
70
|
+
activesupport (= 3.2.13)
|
|
72
71
|
bundler (~> 1.0)
|
|
73
|
-
railties (= 3.2.
|
|
74
|
-
railties (3.2.
|
|
75
|
-
actionpack (= 3.2.
|
|
76
|
-
activesupport (= 3.2.
|
|
72
|
+
railties (= 3.2.13)
|
|
73
|
+
railties (3.2.13)
|
|
74
|
+
actionpack (= 3.2.13)
|
|
75
|
+
activesupport (= 3.2.13)
|
|
77
76
|
rack-ssl (~> 1.3.2)
|
|
78
77
|
rake (>= 0.8.7)
|
|
79
78
|
rdoc (~> 3.4)
|
|
80
79
|
thor (>= 0.14.6, < 2.0)
|
|
81
|
-
rake (10.0.
|
|
82
|
-
rdoc (3.12)
|
|
80
|
+
rake (10.0.4)
|
|
81
|
+
rdoc (3.12.2)
|
|
83
82
|
json (~> 1.4)
|
|
84
|
-
shoulda (3.
|
|
85
|
-
shoulda-context (~> 1.0.1)
|
|
86
|
-
shoulda-matchers (
|
|
87
|
-
shoulda-context (1.
|
|
88
|
-
shoulda-matchers (1.
|
|
83
|
+
shoulda (3.5.0)
|
|
84
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
|
85
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
|
86
|
+
shoulda-context (1.1.2)
|
|
87
|
+
shoulda-matchers (2.1.0)
|
|
89
88
|
activesupport (>= 3.0.0)
|
|
90
89
|
sprockets (2.2.2)
|
|
91
90
|
hike (~> 1.2)
|
|
92
91
|
multi_json (~> 1.0)
|
|
93
92
|
rack (~> 1.0)
|
|
94
93
|
tilt (~> 1.1, != 1.3.0)
|
|
95
|
-
thor (0.
|
|
96
|
-
tilt (1.
|
|
97
|
-
treetop (1.4.
|
|
94
|
+
thor (0.18.1)
|
|
95
|
+
tilt (1.4.1)
|
|
96
|
+
treetop (1.4.14)
|
|
98
97
|
polyglot
|
|
99
98
|
polyglot (>= 0.3.1)
|
|
100
99
|
turn (0.9.6)
|
|
101
100
|
ansi
|
|
102
|
-
tzinfo (0.3.
|
|
101
|
+
tzinfo (0.3.37)
|
|
103
102
|
warden (1.2.1)
|
|
104
103
|
rack (>= 1.0)
|
|
105
104
|
|
|
@@ -110,7 +109,7 @@ DEPENDENCIES
|
|
|
110
109
|
devise (= 2.1.2)
|
|
111
110
|
jeweler (~> 1.6.4)
|
|
112
111
|
pg
|
|
113
|
-
rails (
|
|
112
|
+
rails (= 3.2.13)
|
|
114
113
|
rdoc
|
|
115
|
-
shoulda
|
|
114
|
+
shoulda (= 3.5.0)
|
|
116
115
|
turn
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# milia
|
|
2
2
|
|
|
3
|
-
Milia is a multi-tenanting gem for hosted Rails 3.1 applications which
|
|
4
|
-
devise for user authentication.
|
|
3
|
+
Milia is a multi-tenanting gem for hosted Rails 3.1 applications which uses
|
|
4
|
+
the devise gem for user authentication.
|
|
5
5
|
|
|
6
6
|
## Basic concepts
|
|
7
7
|
|
|
@@ -21,6 +21,14 @@ performance hit, was seriously time-consuming to backup and restore, was invasiv
|
|
|
21
21
|
into the Rails code structure (monkey patching), was complex to implement, and
|
|
22
22
|
couldn't use Rails migration tools as-is.
|
|
23
23
|
|
|
24
|
+
A tenant == an organization; users == members of the organization.
|
|
25
|
+
Only organizations sign up for new tenants, not members (users).
|
|
26
|
+
The very first user of an organization, let's call him the Organizer,
|
|
27
|
+
is the one responsible for initiating the organizational signup.
|
|
28
|
+
The Organizer becomes the first member (user) of the organization (tenant).
|
|
29
|
+
Thereafter, other members only obtain entry to the organization (tenant)
|
|
30
|
+
by invitation. New tenants are not created for every new user.
|
|
31
|
+
|
|
24
32
|
## Structure
|
|
25
33
|
|
|
26
34
|
* necessary models: user, tenant
|
|
@@ -143,6 +151,42 @@ catch any exceptions with the following (be sure to also add the designated meth
|
|
|
143
151
|
rescue_from ::Milia::Control::InvalidTenantAccess, :with => :invalid_tenant
|
|
144
152
|
```
|
|
145
153
|
|
|
154
|
+
You'll need to place prep_signup_view method in application_controller.rb; it sets up any attributes required by your signup form. below is the example from my application.
|
|
155
|
+
|
|
156
|
+
```ruby
|
|
157
|
+
# ------------------------------------------------------------------------------
|
|
158
|
+
# klass_option_obj -- returns a (new?) object of a given klass
|
|
159
|
+
# purpose is to handle the variety of ways to prepare for a view
|
|
160
|
+
# args:
|
|
161
|
+
# klass -- class of object to be returned
|
|
162
|
+
# option_obj -- any one of the following
|
|
163
|
+
# -- nil -- will return klass.new
|
|
164
|
+
# -- object -- will return the object itself
|
|
165
|
+
# -- hash -- will return klass.new( hash ) for parameters
|
|
166
|
+
# ------------------------------------------------------------------------------
|
|
167
|
+
def klass_option_obj(klass, option_obj)
|
|
168
|
+
return option_obj if option_obj.instance_of?(klass)
|
|
169
|
+
option_obj ||= {} # if nil, makes it empty hash
|
|
170
|
+
return klass.send( :new, option_obj )
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# ------------------------------------------------------------------------------
|
|
174
|
+
# prep_signup_view -- prepares for the signup view
|
|
175
|
+
# args:
|
|
176
|
+
# tenant: either existing tenant obj or params for tenant
|
|
177
|
+
# user: either existing user obj or params for user
|
|
178
|
+
# ------------------------------------------------------------------------------
|
|
179
|
+
def prep_signup_view(tenant=nil, user=nil, coupon='')
|
|
180
|
+
@user = klass_option_obj( User, user )
|
|
181
|
+
@tenant = klass_option_obj( Tenant, tenant )
|
|
182
|
+
@coupon = coupon
|
|
183
|
+
@eula = Eula.get_latest.first
|
|
184
|
+
end
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
My signup form has fields for user's email, organization's name (tenant model), coupon code, and current EULA version.
|
|
188
|
+
|
|
189
|
+
|
|
146
190
|
#### routes
|
|
147
191
|
|
|
148
192
|
Add the following line into the devise_for :users block
|
|
@@ -150,9 +194,7 @@ Add the following line into the devise_for :users block
|
|
|
150
194
|
<i>config/routes.rb</i>
|
|
151
195
|
|
|
152
196
|
```ruby
|
|
153
|
-
devise_for :users
|
|
154
|
-
post "users" => "milia/registrations#create"
|
|
155
|
-
end
|
|
197
|
+
devise_for :users, :controllers => { :registrations => "milia/registrations" }
|
|
156
198
|
```
|
|
157
199
|
|
|
158
200
|
### Designate which model determines account
|
|
@@ -354,8 +396,6 @@ load when I start the console. This does the following:
|
|
|
354
396
|
change_tenant(1,1) # or whatever is an appropriate starting user, tenant
|
|
355
397
|
```
|
|
356
398
|
|
|
357
|
-
|
|
358
|
-
|
|
359
399
|
## Cautions
|
|
360
400
|
|
|
361
401
|
* Milia designates a default_scope for all models (both universal and tenanted). From Rails 3.2 onwards, the last designated default scope overrides any prior scopes and will invalidate multi-tenanting; so *DO NOT USE default_scope*
|
|
@@ -364,6 +404,11 @@ change_tenant(1,1) # or whatever is an appropriate starting user, tenant
|
|
|
364
404
|
* The tenant_id of a universal model will always be forced to nil.
|
|
365
405
|
* The tenant_id of a tenanted model will be set to the current_tenant of the current_user upon creation.
|
|
366
406
|
|
|
407
|
+
## Further documentation
|
|
408
|
+
* Check out the three-part blog discussion of _Multi-tenanting Ruby on Rails Applications on Heroku_
|
|
409
|
+
at: http://myrailscraft.blogspot.com/2013/05/multi-tenanting-ruby-on-rails.html
|
|
410
|
+
* See the Milia tutorial at: http://myrailscraft.blogspot.com/2013/05/multi-tenanting-ruby-on-rails_3982.html
|
|
411
|
+
|
|
367
412
|
|
|
368
413
|
## Contributing to milia
|
|
369
414
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.38
|
data/lib/milia/base.rb
CHANGED
|
@@ -28,19 +28,22 @@ module Milia
|
|
|
28
28
|
|
|
29
29
|
# ..........................callback enforcers............................
|
|
30
30
|
before_save do |obj| # force tenant_id to be correct for current_user
|
|
31
|
-
|
|
31
|
+
# raise exception if updates attempted on wrong data
|
|
32
|
+
raise ::Milia::Control::InvalidTenantAccess unless obj.tenant_id == Thread.current[:tenant_id]
|
|
32
33
|
true # ok to proceed
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
# ..........................callback enforcers............................
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
# no longer needed because before_save invoked prior to before_update
|
|
38
|
+
#
|
|
39
|
+
# before_update do |obj| # force tenant_id to be correct for current_user
|
|
40
|
+
# raise ::Milia::Control::InvalidTenantAccess unless obj.tenant_id == Thread.current[:tenant_id]
|
|
41
|
+
# true # ok to proceed
|
|
42
|
+
# end
|
|
40
43
|
|
|
41
44
|
# ..........................callback enforcers............................
|
|
42
45
|
before_destroy do |obj| # force tenant_id to be correct for current_user
|
|
43
|
-
raise ::Control::InvalidTenantAccess unless obj.tenant_id == Thread.current[:tenant_id]
|
|
46
|
+
raise ::Milia::Control::InvalidTenantAccess unless obj.tenant_id == Thread.current[:tenant_id]
|
|
44
47
|
true # ok to proceed
|
|
45
48
|
end
|
|
46
49
|
|
|
@@ -58,19 +61,21 @@ module Milia
|
|
|
58
61
|
|
|
59
62
|
# ..........................callback enforcers............................
|
|
60
63
|
before_save do |obj| # force tenant_id to be universal
|
|
61
|
-
raise ::Control::InvalidTenantAccess unless obj.tenant_id.nil?
|
|
64
|
+
raise ::Milia::Control::InvalidTenantAccess unless obj.tenant_id.nil?
|
|
62
65
|
true # ok to proceed
|
|
63
66
|
end
|
|
64
67
|
|
|
65
68
|
# ..........................callback enforcers............................
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
# before_update do |obj| # force tenant_id to be universal
|
|
70
|
+
# no longer needed because before_save invoked prior to before_update
|
|
71
|
+
#
|
|
72
|
+
# raise ::Milia::Control::InvalidTenantAccess unless obj.tenant_id.nil?
|
|
73
|
+
# true # ok to proceed
|
|
74
|
+
# end
|
|
70
75
|
|
|
71
76
|
# ..........................callback enforcers............................
|
|
72
77
|
before_destroy do |obj| # force tenant_id to be universal
|
|
73
|
-
raise ::Control::InvalidTenantAccess unless obj.tenant_id.nil?
|
|
78
|
+
raise ::Milia::Control::InvalidTenantAccess unless obj.tenant_id.nil?
|
|
74
79
|
true # ok to proceed
|
|
75
80
|
end
|
|
76
81
|
|
data/milia.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "milia"
|
|
8
|
-
s.version = "0.3.
|
|
8
|
+
s.version = "0.3.38"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["David Anderson"]
|
|
12
|
-
s.date = "2013-
|
|
12
|
+
s.date = "2013-06-11"
|
|
13
13
|
s.description = "Transparent Multi-tenanting for hosted Rails 3.1+/Ruby 1.9.2 applications"
|
|
14
14
|
s.email = "dsaronin@gmail.com"
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -40,6 +40,7 @@ Gem::Specification.new do |s|
|
|
|
40
40
|
"test/rails_app/.gitignore",
|
|
41
41
|
"test/rails_app/Gemfile",
|
|
42
42
|
"test/rails_app/Gemfile.lock",
|
|
43
|
+
"test/rails_app/Gemfile.lock.backup",
|
|
43
44
|
"test/rails_app/Procfile",
|
|
44
45
|
"test/rails_app/README",
|
|
45
46
|
"test/rails_app/Rakefile",
|
|
@@ -134,27 +135,27 @@ Gem::Specification.new do |s|
|
|
|
134
135
|
s.specification_version = 3
|
|
135
136
|
|
|
136
137
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
137
|
-
s.add_runtime_dependency(%q<rails>, ["
|
|
138
|
+
s.add_runtime_dependency(%q<rails>, ["= 3.2.13"])
|
|
138
139
|
s.add_runtime_dependency(%q<devise>, ["= 2.1.2"])
|
|
139
140
|
s.add_development_dependency(%q<pg>, [">= 0"])
|
|
140
|
-
s.add_development_dependency(%q<shoulda>, ["
|
|
141
|
+
s.add_development_dependency(%q<shoulda>, ["= 3.5.0"])
|
|
141
142
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
|
142
143
|
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
|
143
144
|
s.add_development_dependency(%q<turn>, [">= 0"])
|
|
144
145
|
else
|
|
145
|
-
s.add_dependency(%q<rails>, ["
|
|
146
|
+
s.add_dependency(%q<rails>, ["= 3.2.13"])
|
|
146
147
|
s.add_dependency(%q<devise>, ["= 2.1.2"])
|
|
147
148
|
s.add_dependency(%q<pg>, [">= 0"])
|
|
148
|
-
s.add_dependency(%q<shoulda>, ["
|
|
149
|
+
s.add_dependency(%q<shoulda>, ["= 3.5.0"])
|
|
149
150
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
|
150
151
|
s.add_dependency(%q<rdoc>, [">= 0"])
|
|
151
152
|
s.add_dependency(%q<turn>, [">= 0"])
|
|
152
153
|
end
|
|
153
154
|
else
|
|
154
|
-
s.add_dependency(%q<rails>, ["
|
|
155
|
+
s.add_dependency(%q<rails>, ["= 3.2.13"])
|
|
155
156
|
s.add_dependency(%q<devise>, ["= 2.1.2"])
|
|
156
157
|
s.add_dependency(%q<pg>, [">= 0"])
|
|
157
|
-
s.add_dependency(%q<shoulda>, ["
|
|
158
|
+
s.add_dependency(%q<shoulda>, ["= 3.5.0"])
|
|
158
159
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
|
159
160
|
s.add_dependency(%q<rdoc>, [">= 0"])
|
|
160
161
|
s.add_dependency(%q<turn>, [">= 0"])
|
data/test/rails_app/Gemfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
source 'http://rubygems.org'
|
|
2
2
|
|
|
3
|
-
gem 'rails', '3.
|
|
3
|
+
gem 'rails', '3.2.13'
|
|
4
4
|
|
|
5
5
|
# Bundle edge Rails instead:
|
|
6
6
|
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
|
@@ -8,15 +8,15 @@ gem 'rails', '3.1.1'
|
|
|
8
8
|
gem 'thin'
|
|
9
9
|
gem 'pg'
|
|
10
10
|
gem 'rdoc'
|
|
11
|
-
gem 'devise', ">= 1.
|
|
11
|
+
gem 'devise', ">= 2.1.2"
|
|
12
12
|
gem 'foreman'
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
# Gems used only for assets and not required
|
|
16
16
|
# in production environments by default.
|
|
17
17
|
group :assets do
|
|
18
|
-
gem 'sass-rails', '
|
|
19
|
-
gem 'coffee-rails', '
|
|
18
|
+
gem 'sass-rails', '> 3.2'
|
|
19
|
+
gem 'coffee-rails', '> 3.2'
|
|
20
20
|
gem 'uglifier', '>= 1.0.3'
|
|
21
21
|
gem 'execjs'
|
|
22
22
|
gem 'therubyracer'
|
|
@@ -38,9 +38,11 @@ gem 'jquery-rails'
|
|
|
38
38
|
|
|
39
39
|
group :test do
|
|
40
40
|
gem "factory_girl_rails", "~> 1.2"
|
|
41
|
-
gem "shoulda", "
|
|
41
|
+
gem "shoulda", "3.5.0"
|
|
42
|
+
gem "shoulda-matchers", "~>2.1.0"
|
|
43
|
+
gem "shoulda-context", "~>1.1.2"
|
|
42
44
|
# Pretty printed test output
|
|
43
45
|
gem 'turn', :require => false
|
|
44
46
|
end
|
|
45
47
|
|
|
46
|
-
gem 'milia', :path => "../../../milia"
|
|
48
|
+
gem 'milia', :path => "../../../milia"
|
data/test/rails_app/Gemfile.lock
CHANGED
|
@@ -1,161 +1,167 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../../../milia
|
|
3
3
|
specs:
|
|
4
|
-
milia (0.3.
|
|
5
|
-
devise (
|
|
6
|
-
rails (
|
|
4
|
+
milia (0.3.37)
|
|
5
|
+
devise (= 2.1.2)
|
|
6
|
+
rails (= 3.2.13)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: http://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
actionmailer (3.
|
|
12
|
-
actionpack (= 3.
|
|
13
|
-
mail (~> 2.3
|
|
14
|
-
actionpack (3.
|
|
15
|
-
activemodel (= 3.
|
|
16
|
-
activesupport (= 3.
|
|
11
|
+
actionmailer (3.2.13)
|
|
12
|
+
actionpack (= 3.2.13)
|
|
13
|
+
mail (~> 2.5.3)
|
|
14
|
+
actionpack (3.2.13)
|
|
15
|
+
activemodel (= 3.2.13)
|
|
16
|
+
activesupport (= 3.2.13)
|
|
17
17
|
builder (~> 3.0.0)
|
|
18
18
|
erubis (~> 2.7.0)
|
|
19
|
-
|
|
20
|
-
rack (~> 1.
|
|
21
|
-
rack-cache (~> 1.
|
|
22
|
-
rack-mount (~> 0.8.2)
|
|
19
|
+
journey (~> 1.0.4)
|
|
20
|
+
rack (~> 1.4.5)
|
|
21
|
+
rack-cache (~> 1.2)
|
|
23
22
|
rack-test (~> 0.6.1)
|
|
24
|
-
sprockets (~> 2.
|
|
25
|
-
activemodel (3.
|
|
26
|
-
activesupport (= 3.
|
|
23
|
+
sprockets (~> 2.2.1)
|
|
24
|
+
activemodel (3.2.13)
|
|
25
|
+
activesupport (= 3.2.13)
|
|
27
26
|
builder (~> 3.0.0)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
arel (~> 2.2.1)
|
|
27
|
+
activerecord (3.2.13)
|
|
28
|
+
activemodel (= 3.2.13)
|
|
29
|
+
activesupport (= 3.2.13)
|
|
30
|
+
arel (~> 3.0.2)
|
|
33
31
|
tzinfo (~> 0.3.29)
|
|
34
|
-
activeresource (3.
|
|
35
|
-
activemodel (= 3.
|
|
36
|
-
activesupport (= 3.
|
|
37
|
-
activesupport (3.
|
|
32
|
+
activeresource (3.2.13)
|
|
33
|
+
activemodel (= 3.2.13)
|
|
34
|
+
activesupport (= 3.2.13)
|
|
35
|
+
activesupport (3.2.13)
|
|
36
|
+
i18n (= 0.6.1)
|
|
38
37
|
multi_json (~> 1.0)
|
|
39
|
-
ansi (1.3
|
|
40
|
-
arel (
|
|
38
|
+
ansi (1.4.3)
|
|
39
|
+
arel (3.0.2)
|
|
41
40
|
bcrypt-ruby (3.0.1)
|
|
42
|
-
builder (3.0.
|
|
43
|
-
coffee-rails (3.
|
|
41
|
+
builder (3.0.4)
|
|
42
|
+
coffee-rails (3.2.2)
|
|
44
43
|
coffee-script (>= 2.2.0)
|
|
45
|
-
railties (~> 3.
|
|
44
|
+
railties (~> 3.2.0)
|
|
46
45
|
coffee-script (2.2.0)
|
|
47
46
|
coffee-script-source
|
|
48
47
|
execjs
|
|
49
|
-
coffee-script-source (1.
|
|
50
|
-
daemons (1.1.
|
|
51
|
-
devise (1.
|
|
48
|
+
coffee-script-source (1.6.2)
|
|
49
|
+
daemons (1.1.9)
|
|
50
|
+
devise (2.1.2)
|
|
52
51
|
bcrypt-ruby (~> 3.0)
|
|
53
|
-
orm_adapter (~> 0.
|
|
54
|
-
|
|
52
|
+
orm_adapter (~> 0.1)
|
|
53
|
+
railties (~> 3.1)
|
|
54
|
+
warden (~> 1.2.1)
|
|
55
|
+
dotenv (0.7.0)
|
|
55
56
|
erubis (2.7.0)
|
|
56
|
-
eventmachine (0.
|
|
57
|
-
execjs (1.
|
|
57
|
+
eventmachine (1.0.3)
|
|
58
|
+
execjs (1.4.0)
|
|
58
59
|
multi_json (~> 1.0)
|
|
59
|
-
factory_girl (2.
|
|
60
|
-
activesupport
|
|
61
|
-
factory_girl_rails (1.
|
|
62
|
-
factory_girl (~> 2.
|
|
60
|
+
factory_girl (2.6.4)
|
|
61
|
+
activesupport (>= 2.3.9)
|
|
62
|
+
factory_girl_rails (1.7.0)
|
|
63
|
+
factory_girl (~> 2.6.0)
|
|
63
64
|
railties (>= 3.0.0)
|
|
64
|
-
foreman (0.
|
|
65
|
-
|
|
65
|
+
foreman (0.63.0)
|
|
66
|
+
dotenv (>= 0.7)
|
|
66
67
|
thor (>= 0.13.6)
|
|
67
|
-
hike (1.2.
|
|
68
|
-
i18n (0.6.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
hike (1.2.3)
|
|
69
|
+
i18n (0.6.1)
|
|
70
|
+
journey (1.0.4)
|
|
71
|
+
jquery-rails (3.0.1)
|
|
72
|
+
railties (>= 3.0, < 5.0)
|
|
73
|
+
thor (>= 0.14, < 2.0)
|
|
74
|
+
json (1.8.0)
|
|
75
|
+
libv8 (3.11.8.17)
|
|
76
|
+
mail (2.5.4)
|
|
76
77
|
mime-types (~> 1.16)
|
|
77
78
|
treetop (~> 1.4.8)
|
|
78
|
-
mime-types (1.
|
|
79
|
-
multi_json (1.
|
|
80
|
-
orm_adapter (0.0
|
|
81
|
-
pg (0.
|
|
79
|
+
mime-types (1.23)
|
|
80
|
+
multi_json (1.7.6)
|
|
81
|
+
orm_adapter (0.4.0)
|
|
82
|
+
pg (0.15.1)
|
|
82
83
|
polyglot (0.3.3)
|
|
83
|
-
rack (1.
|
|
84
|
-
rack-cache (1.
|
|
84
|
+
rack (1.4.5)
|
|
85
|
+
rack-cache (1.2)
|
|
85
86
|
rack (>= 0.4)
|
|
86
|
-
rack-
|
|
87
|
-
rack (>= 1.0.0)
|
|
88
|
-
rack-ssl (1.3.2)
|
|
87
|
+
rack-ssl (1.3.3)
|
|
89
88
|
rack
|
|
90
|
-
rack-test (0.6.
|
|
89
|
+
rack-test (0.6.2)
|
|
91
90
|
rack (>= 1.0)
|
|
92
|
-
rails (3.
|
|
93
|
-
actionmailer (= 3.
|
|
94
|
-
actionpack (= 3.
|
|
95
|
-
activerecord (= 3.
|
|
96
|
-
activeresource (= 3.
|
|
97
|
-
activesupport (= 3.
|
|
91
|
+
rails (3.2.13)
|
|
92
|
+
actionmailer (= 3.2.13)
|
|
93
|
+
actionpack (= 3.2.13)
|
|
94
|
+
activerecord (= 3.2.13)
|
|
95
|
+
activeresource (= 3.2.13)
|
|
96
|
+
activesupport (= 3.2.13)
|
|
98
97
|
bundler (~> 1.0)
|
|
99
|
-
railties (= 3.
|
|
100
|
-
railties (3.
|
|
101
|
-
actionpack (= 3.
|
|
102
|
-
activesupport (= 3.
|
|
98
|
+
railties (= 3.2.13)
|
|
99
|
+
railties (3.2.13)
|
|
100
|
+
actionpack (= 3.2.13)
|
|
101
|
+
activesupport (= 3.2.13)
|
|
103
102
|
rack-ssl (~> 1.3.2)
|
|
104
103
|
rake (>= 0.8.7)
|
|
105
104
|
rdoc (~> 3.4)
|
|
106
|
-
thor (
|
|
107
|
-
rake (0.
|
|
108
|
-
rdoc (3.
|
|
105
|
+
thor (>= 0.14.6, < 2.0)
|
|
106
|
+
rake (10.0.4)
|
|
107
|
+
rdoc (3.12.2)
|
|
109
108
|
json (~> 1.4)
|
|
110
|
-
|
|
111
|
-
sass
|
|
112
|
-
|
|
113
|
-
railties (~> 3.
|
|
114
|
-
sass (>= 3.1.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
109
|
+
ref (1.0.5)
|
|
110
|
+
sass (3.2.9)
|
|
111
|
+
sass-rails (3.2.6)
|
|
112
|
+
railties (~> 3.2.0)
|
|
113
|
+
sass (>= 3.1.10)
|
|
114
|
+
tilt (~> 1.3)
|
|
115
|
+
shoulda (3.5.0)
|
|
116
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
|
117
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
|
118
|
+
shoulda-context (1.1.2)
|
|
119
|
+
shoulda-matchers (2.1.0)
|
|
120
|
+
activesupport (>= 3.0.0)
|
|
121
|
+
sprockets (2.2.2)
|
|
119
122
|
hike (~> 1.2)
|
|
123
|
+
multi_json (~> 1.0)
|
|
120
124
|
rack (~> 1.0)
|
|
121
125
|
tilt (~> 1.1, != 1.3.0)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
thin (1.
|
|
126
|
+
therubyracer (0.11.4)
|
|
127
|
+
libv8 (~> 3.11.8.12)
|
|
128
|
+
ref
|
|
129
|
+
thin (1.5.1)
|
|
126
130
|
daemons (>= 1.0.9)
|
|
127
131
|
eventmachine (>= 0.12.6)
|
|
128
132
|
rack (>= 1.0.0)
|
|
129
|
-
thor (0.
|
|
130
|
-
tilt (1.
|
|
131
|
-
treetop (1.4.
|
|
133
|
+
thor (0.18.1)
|
|
134
|
+
tilt (1.4.1)
|
|
135
|
+
treetop (1.4.14)
|
|
132
136
|
polyglot
|
|
133
137
|
polyglot (>= 0.3.1)
|
|
134
|
-
turn (0.
|
|
138
|
+
turn (0.9.6)
|
|
135
139
|
ansi
|
|
136
|
-
tzinfo (0.3.
|
|
137
|
-
uglifier (1.
|
|
140
|
+
tzinfo (0.3.37)
|
|
141
|
+
uglifier (2.1.1)
|
|
138
142
|
execjs (>= 0.3.0)
|
|
139
|
-
multi_json (>= 1.0.2)
|
|
140
|
-
warden (1.
|
|
143
|
+
multi_json (~> 1.0, >= 1.0.2)
|
|
144
|
+
warden (1.2.1)
|
|
141
145
|
rack (>= 1.0)
|
|
142
146
|
|
|
143
147
|
PLATFORMS
|
|
144
148
|
ruby
|
|
145
149
|
|
|
146
150
|
DEPENDENCIES
|
|
147
|
-
coffee-rails (
|
|
148
|
-
devise (>= 1.
|
|
151
|
+
coffee-rails (> 3.2)
|
|
152
|
+
devise (>= 2.1.2)
|
|
149
153
|
execjs
|
|
150
154
|
factory_girl_rails (~> 1.2)
|
|
151
155
|
foreman
|
|
152
156
|
jquery-rails
|
|
153
157
|
milia!
|
|
154
158
|
pg
|
|
155
|
-
rails (= 3.
|
|
159
|
+
rails (= 3.2.13)
|
|
156
160
|
rdoc
|
|
157
|
-
sass-rails (
|
|
158
|
-
shoulda
|
|
161
|
+
sass-rails (> 3.2)
|
|
162
|
+
shoulda (= 3.5.0)
|
|
163
|
+
shoulda-context (~> 1.1.2)
|
|
164
|
+
shoulda-matchers (~> 2.1.0)
|
|
159
165
|
therubyracer
|
|
160
166
|
thin
|
|
161
167
|
turn
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ../../../milia
|
|
3
|
+
specs:
|
|
4
|
+
milia (0.3.34)
|
|
5
|
+
devise (= 2.1.2)
|
|
6
|
+
rails (>= 3.2.9)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: http://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
actionmailer (3.2.11)
|
|
12
|
+
actionpack (= 3.2.11)
|
|
13
|
+
mail (~> 2.4.4)
|
|
14
|
+
actionpack (3.2.11)
|
|
15
|
+
activemodel (= 3.2.11)
|
|
16
|
+
activesupport (= 3.2.11)
|
|
17
|
+
builder (~> 3.0.0)
|
|
18
|
+
erubis (~> 2.7.0)
|
|
19
|
+
journey (~> 1.0.4)
|
|
20
|
+
rack (~> 1.4.0)
|
|
21
|
+
rack-cache (~> 1.2)
|
|
22
|
+
rack-test (~> 0.6.1)
|
|
23
|
+
sprockets (~> 2.2.1)
|
|
24
|
+
activemodel (3.2.11)
|
|
25
|
+
activesupport (= 3.2.11)
|
|
26
|
+
builder (~> 3.0.0)
|
|
27
|
+
activerecord (3.2.11)
|
|
28
|
+
activemodel (= 3.2.11)
|
|
29
|
+
activesupport (= 3.2.11)
|
|
30
|
+
arel (~> 3.0.2)
|
|
31
|
+
tzinfo (~> 0.3.29)
|
|
32
|
+
activeresource (3.2.11)
|
|
33
|
+
activemodel (= 3.2.11)
|
|
34
|
+
activesupport (= 3.2.11)
|
|
35
|
+
activesupport (3.2.11)
|
|
36
|
+
i18n (~> 0.6)
|
|
37
|
+
multi_json (~> 1.0)
|
|
38
|
+
ansi (1.3.0)
|
|
39
|
+
arel (3.0.2)
|
|
40
|
+
bcrypt-ruby (3.0.1)
|
|
41
|
+
builder (3.0.4)
|
|
42
|
+
coffee-rails (3.2.2)
|
|
43
|
+
coffee-script (>= 2.2.0)
|
|
44
|
+
railties (~> 3.2.0)
|
|
45
|
+
coffee-script (2.2.0)
|
|
46
|
+
coffee-script-source
|
|
47
|
+
execjs
|
|
48
|
+
coffee-script-source (1.6.2)
|
|
49
|
+
daemons (1.1.4)
|
|
50
|
+
devise (2.1.2)
|
|
51
|
+
bcrypt-ruby (~> 3.0)
|
|
52
|
+
orm_adapter (~> 0.1)
|
|
53
|
+
railties (~> 3.1)
|
|
54
|
+
warden (~> 1.2.1)
|
|
55
|
+
erubis (2.7.0)
|
|
56
|
+
eventmachine (0.12.10)
|
|
57
|
+
execjs (1.4.0)
|
|
58
|
+
multi_json (~> 1.0)
|
|
59
|
+
factory_girl (2.2.0)
|
|
60
|
+
activesupport
|
|
61
|
+
factory_girl_rails (1.3.0)
|
|
62
|
+
factory_girl (~> 2.2.0)
|
|
63
|
+
railties (>= 3.0.0)
|
|
64
|
+
foreman (0.25.0)
|
|
65
|
+
term-ansicolor (~> 1.0.5)
|
|
66
|
+
thor (>= 0.13.6)
|
|
67
|
+
hike (1.2.3)
|
|
68
|
+
i18n (0.6.4)
|
|
69
|
+
journey (1.0.4)
|
|
70
|
+
jquery-rails (1.0.16)
|
|
71
|
+
railties (~> 3.0)
|
|
72
|
+
thor (~> 0.14)
|
|
73
|
+
json (1.8.0)
|
|
74
|
+
libv8 (3.3.10.2)
|
|
75
|
+
mail (2.4.4)
|
|
76
|
+
i18n (>= 0.4.0)
|
|
77
|
+
mime-types (~> 1.16)
|
|
78
|
+
treetop (~> 1.4.8)
|
|
79
|
+
mime-types (1.23)
|
|
80
|
+
multi_json (1.7.6)
|
|
81
|
+
orm_adapter (0.4.0)
|
|
82
|
+
pg (0.15.1)
|
|
83
|
+
polyglot (0.3.3)
|
|
84
|
+
rack (1.4.5)
|
|
85
|
+
rack-cache (1.2)
|
|
86
|
+
rack (>= 0.4)
|
|
87
|
+
rack-ssl (1.3.3)
|
|
88
|
+
rack
|
|
89
|
+
rack-test (0.6.2)
|
|
90
|
+
rack (>= 1.0)
|
|
91
|
+
rails (3.2.11)
|
|
92
|
+
actionmailer (= 3.2.11)
|
|
93
|
+
actionpack (= 3.2.11)
|
|
94
|
+
activerecord (= 3.2.11)
|
|
95
|
+
activeresource (= 3.2.11)
|
|
96
|
+
activesupport (= 3.2.11)
|
|
97
|
+
bundler (~> 1.0)
|
|
98
|
+
railties (= 3.2.11)
|
|
99
|
+
railties (3.2.11)
|
|
100
|
+
actionpack (= 3.2.11)
|
|
101
|
+
activesupport (= 3.2.11)
|
|
102
|
+
rack-ssl (~> 1.3.2)
|
|
103
|
+
rake (>= 0.8.7)
|
|
104
|
+
rdoc (~> 3.4)
|
|
105
|
+
thor (>= 0.14.6, < 2.0)
|
|
106
|
+
rake (10.0.4)
|
|
107
|
+
rdoc (3.12.2)
|
|
108
|
+
json (~> 1.4)
|
|
109
|
+
sass (3.2.9)
|
|
110
|
+
sass-rails (3.2.6)
|
|
111
|
+
railties (~> 3.2.0)
|
|
112
|
+
sass (>= 3.1.10)
|
|
113
|
+
tilt (~> 1.3)
|
|
114
|
+
shoulda (3.5.0)
|
|
115
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
|
116
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
|
117
|
+
shoulda-context (1.1.2)
|
|
118
|
+
shoulda-matchers (2.1.0)
|
|
119
|
+
activesupport (>= 3.0.0)
|
|
120
|
+
sprockets (2.2.2)
|
|
121
|
+
hike (~> 1.2)
|
|
122
|
+
multi_json (~> 1.0)
|
|
123
|
+
rack (~> 1.0)
|
|
124
|
+
tilt (~> 1.1, != 1.3.0)
|
|
125
|
+
term-ansicolor (1.0.7)
|
|
126
|
+
therubyracer (0.9.8)
|
|
127
|
+
libv8 (~> 3.3.10)
|
|
128
|
+
thin (1.2.11)
|
|
129
|
+
daemons (>= 1.0.9)
|
|
130
|
+
eventmachine (>= 0.12.6)
|
|
131
|
+
rack (>= 1.0.0)
|
|
132
|
+
thor (0.18.1)
|
|
133
|
+
tilt (1.4.1)
|
|
134
|
+
treetop (1.4.14)
|
|
135
|
+
polyglot
|
|
136
|
+
polyglot (>= 0.3.1)
|
|
137
|
+
turn (0.8.3)
|
|
138
|
+
ansi
|
|
139
|
+
tzinfo (0.3.37)
|
|
140
|
+
uglifier (1.0.4)
|
|
141
|
+
execjs (>= 0.3.0)
|
|
142
|
+
multi_json (>= 1.0.2)
|
|
143
|
+
warden (1.2.1)
|
|
144
|
+
rack (>= 1.0)
|
|
145
|
+
|
|
146
|
+
PLATFORMS
|
|
147
|
+
ruby
|
|
148
|
+
|
|
149
|
+
DEPENDENCIES
|
|
150
|
+
coffee-rails (> 3.2)
|
|
151
|
+
devise (>= 2.1.2)
|
|
152
|
+
execjs
|
|
153
|
+
factory_girl_rails (~> 1.2)
|
|
154
|
+
foreman
|
|
155
|
+
jquery-rails
|
|
156
|
+
milia!
|
|
157
|
+
pg
|
|
158
|
+
rails (= 3.2.11)
|
|
159
|
+
rdoc
|
|
160
|
+
sass-rails (> 3.2)
|
|
161
|
+
shoulda (= 3.5.0)
|
|
162
|
+
shoulda-context (~> 1.1.2)
|
|
163
|
+
shoulda-matchers (~> 2.1.0)
|
|
164
|
+
therubyracer
|
|
165
|
+
thin
|
|
166
|
+
turn
|
|
167
|
+
uglifier (>= 1.0.3)
|
|
@@ -92,10 +92,6 @@ Devise.setup do |config|
|
|
|
92
92
|
# If true, extends the user's remember period when remembered via cookie.
|
|
93
93
|
# config.extend_remember_period = false
|
|
94
94
|
|
|
95
|
-
# If true, uses the password salt as remember token. This should be turned
|
|
96
|
-
# to false if you are not using database authenticatable.
|
|
97
|
-
config.use_salt_as_remember_token = true
|
|
98
|
-
|
|
99
95
|
# Options to be passed to the created cookie. For instance, you can set
|
|
100
96
|
# :secure => true in order to force SSL only cookies.
|
|
101
97
|
# config.cookie_options = {}
|
|
@@ -2,9 +2,7 @@ RailsApp::Application.routes.draw do
|
|
|
2
2
|
root :to => "home#index"
|
|
3
3
|
get "home/index"
|
|
4
4
|
|
|
5
|
-
devise_for :users
|
|
6
|
-
post "users" => "milia/registrations#create"
|
|
7
|
-
end
|
|
5
|
+
devise_for :users , :controllers => { :registrations => "milia/registrations" }
|
|
8
6
|
|
|
9
7
|
# The priority is based upon order of creation:
|
|
10
8
|
# first created -> highest priority.
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
class DeviseCreateUsers < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
|
3
3
|
create_table(:users) do |t|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
t.string :email, :null => false, :default => ""
|
|
5
|
+
t.string :encrypted_password, :null => false, :default => ""
|
|
6
|
+
t.string :reset_password_token
|
|
7
|
+
t.datetime :reset_password_sent_at
|
|
8
|
+
t.datetime :remember_created_at
|
|
9
|
+
t.integer :sign_in_count, :default => 0
|
|
10
|
+
t.datetime :current_sign_in_at
|
|
11
|
+
t.datetime :last_sign_in_at
|
|
12
|
+
t.string :current_sign_in_ip
|
|
13
|
+
t.string :last_sign_in_ip
|
|
14
|
+
# t.string :password_salt # t.encryptable
|
|
15
|
+
t.string :confirmation_token
|
|
16
|
+
t.datetime :confirmed_at
|
|
17
|
+
t.datetime :confirmation_sent_at
|
|
18
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
|
19
|
+
## Lockable
|
|
20
|
+
# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
|
|
21
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
|
22
|
+
# t.datetime :locked_at
|
|
23
|
+
t.string :authentication_token
|
|
13
24
|
|
|
14
25
|
t.references :tenant
|
|
15
26
|
t.timestamps
|
data/test/rails_app/db/schema.rb
CHANGED
|
@@ -17,8 +17,8 @@ ActiveRecord::Schema.define(:version => 20111013053403) do
|
|
|
17
17
|
t.integer "tenant_id"
|
|
18
18
|
t.integer "user_id"
|
|
19
19
|
t.string "name"
|
|
20
|
-
t.datetime "created_at"
|
|
21
|
-
t.datetime "updated_at"
|
|
20
|
+
t.datetime "created_at", :null => false
|
|
21
|
+
t.datetime "updated_at", :null => false
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
add_index "authors", ["tenant_id"], :name => "index_authors_on_tenant_id"
|
|
@@ -29,8 +29,8 @@ ActiveRecord::Schema.define(:version => 20111013053403) do
|
|
|
29
29
|
t.integer "team_id"
|
|
30
30
|
t.datetime "cal_start"
|
|
31
31
|
t.datetime "cal_end"
|
|
32
|
-
t.datetime "created_at"
|
|
33
|
-
t.datetime "updated_at"
|
|
32
|
+
t.datetime "created_at", :null => false
|
|
33
|
+
t.datetime "updated_at", :null => false
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
add_index "calendars", ["team_id"], :name => "index_calendars_on_team_id"
|
|
@@ -41,8 +41,8 @@ ActiveRecord::Schema.define(:version => 20111013053403) do
|
|
|
41
41
|
t.integer "author_id"
|
|
42
42
|
t.integer "zine_id"
|
|
43
43
|
t.string "content"
|
|
44
|
-
t.datetime "created_at"
|
|
45
|
-
t.datetime "updated_at"
|
|
44
|
+
t.datetime "created_at", :null => false
|
|
45
|
+
t.datetime "updated_at", :null => false
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
add_index "posts", ["author_id"], :name => "index_posts_on_author_id"
|
|
@@ -52,8 +52,8 @@ ActiveRecord::Schema.define(:version => 20111013053403) do
|
|
|
52
52
|
create_table "sessions", :force => true do |t|
|
|
53
53
|
t.string "session_id", :null => false
|
|
54
54
|
t.text "data"
|
|
55
|
-
t.datetime "created_at"
|
|
56
|
-
t.datetime "updated_at"
|
|
55
|
+
t.datetime "created_at", :null => false
|
|
56
|
+
t.datetime "updated_at", :null => false
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
|
@@ -63,8 +63,8 @@ ActiveRecord::Schema.define(:version => 20111013053403) do
|
|
|
63
63
|
t.integer "tenant_id"
|
|
64
64
|
t.integer "author_id"
|
|
65
65
|
t.integer "team_id"
|
|
66
|
-
t.datetime "created_at"
|
|
67
|
-
t.datetime "updated_at"
|
|
66
|
+
t.datetime "created_at", :null => false
|
|
67
|
+
t.datetime "updated_at", :null => false
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
add_index "team_assets", ["author_id"], :name => "index_team_assets_on_author_id"
|
|
@@ -74,16 +74,16 @@ ActiveRecord::Schema.define(:version => 20111013053403) do
|
|
|
74
74
|
create_table "teams", :force => true do |t|
|
|
75
75
|
t.integer "tenant_id"
|
|
76
76
|
t.string "name"
|
|
77
|
-
t.datetime "created_at"
|
|
78
|
-
t.datetime "updated_at"
|
|
77
|
+
t.datetime "created_at", :null => false
|
|
78
|
+
t.datetime "updated_at", :null => false
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
add_index "teams", ["tenant_id"], :name => "index_teams_on_tenant_id"
|
|
82
82
|
|
|
83
83
|
create_table "tenants", :force => true do |t|
|
|
84
84
|
t.integer "tenant_id"
|
|
85
|
-
t.datetime "created_at"
|
|
86
|
-
t.datetime "updated_at"
|
|
85
|
+
t.datetime "created_at", :null => false
|
|
86
|
+
t.datetime "updated_at", :null => false
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
create_table "tenants_users", :id => false, :force => true do |t|
|
|
@@ -95,12 +95,12 @@ ActiveRecord::Schema.define(:version => 20111013053403) do
|
|
|
95
95
|
add_index "tenants_users", ["user_id"], :name => "index_tenants_users_on_user_id"
|
|
96
96
|
|
|
97
97
|
create_table "users", :force => true do |t|
|
|
98
|
-
t.string "email",
|
|
99
|
-
t.string "encrypted_password", :
|
|
98
|
+
t.string "email", :default => "", :null => false
|
|
99
|
+
t.string "encrypted_password", :default => "", :null => false
|
|
100
100
|
t.string "reset_password_token"
|
|
101
101
|
t.datetime "reset_password_sent_at"
|
|
102
102
|
t.datetime "remember_created_at"
|
|
103
|
-
t.integer "sign_in_count",
|
|
103
|
+
t.integer "sign_in_count", :default => 0
|
|
104
104
|
t.datetime "current_sign_in_at"
|
|
105
105
|
t.datetime "last_sign_in_at"
|
|
106
106
|
t.string "current_sign_in_ip"
|
|
@@ -108,10 +108,11 @@ ActiveRecord::Schema.define(:version => 20111013053403) do
|
|
|
108
108
|
t.string "confirmation_token"
|
|
109
109
|
t.datetime "confirmed_at"
|
|
110
110
|
t.datetime "confirmation_sent_at"
|
|
111
|
+
t.string "unconfirmed_email"
|
|
111
112
|
t.string "authentication_token"
|
|
112
113
|
t.integer "tenant_id"
|
|
113
|
-
t.datetime "created_at"
|
|
114
|
-
t.datetime "updated_at"
|
|
114
|
+
t.datetime "created_at", :null => false
|
|
115
|
+
t.datetime "updated_at", :null => false
|
|
115
116
|
end
|
|
116
117
|
|
|
117
118
|
add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token", :unique => true
|
|
@@ -122,8 +123,8 @@ ActiveRecord::Schema.define(:version => 20111013053403) do
|
|
|
122
123
|
create_table "zines", :force => true do |t|
|
|
123
124
|
t.integer "tenant_id"
|
|
124
125
|
t.integer "calendar_id"
|
|
125
|
-
t.datetime "created_at"
|
|
126
|
-
t.datetime "updated_at"
|
|
126
|
+
t.datetime "created_at", :null => false
|
|
127
|
+
t.datetime "updated_at", :null => false
|
|
127
128
|
end
|
|
128
129
|
|
|
129
130
|
add_index "zines", ["calendar_id"], :name => "index_zines_on_calendar_id"
|
|
@@ -2,11 +2,6 @@ ENV["RAILS_ENV"] = "test"
|
|
|
2
2
|
require File.expand_path('../../config/environment', __FILE__)
|
|
3
3
|
require 'rails/test_help'
|
|
4
4
|
|
|
5
|
-
# Shoulda looks for RAILS_ROOT before loading shoulda/rails, and Rails 3.1
|
|
6
|
-
# doesn't have that anymore.
|
|
7
|
-
|
|
8
|
-
require 'shoulda/rails'
|
|
9
|
-
|
|
10
5
|
class ActiveSupport::TestCase
|
|
11
6
|
|
|
12
7
|
class << self
|
|
@@ -46,11 +46,13 @@ class PostTest < ActiveSupport::TestCase
|
|
|
46
46
|
should "see jemell in two tenants with dif posts" do
|
|
47
47
|
ActiveSupport::TestCase.set_tenant( @islesmile )
|
|
48
48
|
assert_equal 1, @target.posts.size
|
|
49
|
-
|
|
49
|
+
assert %w(wild_blue passion_pink mellow_yellow).include?( @target.posts.first.content.sub(/_\d+/,"") )
|
|
50
50
|
|
|
51
51
|
ActiveSupport::TestCase.set_tenant( @mangoland )
|
|
52
52
|
assert_equal 2, @target.posts.size
|
|
53
|
-
|
|
53
|
+
assert @target.posts.all?{ |p|
|
|
54
|
+
%w(wild_blue passion_pink mellow_yellow).include?( p.content.sub(/_\d+/,"") )
|
|
55
|
+
}
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
should "zoom get all team posts" do
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
3
|
class TenantTest < ActiveSupport::TestCase
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
context "a user" do
|
|
7
|
+
|
|
8
|
+
setup do
|
|
9
|
+
setup_world()
|
|
10
|
+
@user = Factory( :user )
|
|
11
|
+
@post = Factory( :post )
|
|
12
|
+
ActiveSupport::TestCase.reset_tenant() # clear the tenant for testing
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
should "exception if tenant is different" do
|
|
17
|
+
ActiveSupport::TestCase.reset_tenant
|
|
18
|
+
|
|
19
|
+
assert_raise(::Milia::Control::InvalidTenantAccess,
|
|
20
|
+
"InvalidTenantAccess if tenants dont match"){
|
|
21
|
+
@post.update_attributes( :content => "duck walk" )
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
end # context
|
|
27
|
+
|
|
28
|
+
end # class test
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: milia
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.38
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,24 +9,24 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
|
-
- -
|
|
19
|
+
- - '='
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 3.2.
|
|
21
|
+
version: 3.2.13
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
25
|
none: false
|
|
26
26
|
requirements:
|
|
27
|
-
- -
|
|
27
|
+
- - '='
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 3.2.
|
|
29
|
+
version: 3.2.13
|
|
30
30
|
- !ruby/object:Gem::Dependency
|
|
31
31
|
name: devise
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -64,17 +64,17 @@ dependencies:
|
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
|
65
65
|
none: false
|
|
66
66
|
requirements:
|
|
67
|
-
- -
|
|
67
|
+
- - '='
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version:
|
|
69
|
+
version: 3.5.0
|
|
70
70
|
type: :development
|
|
71
71
|
prerelease: false
|
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
73
|
none: false
|
|
74
74
|
requirements:
|
|
75
|
-
- -
|
|
75
|
+
- - '='
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
|
-
version:
|
|
77
|
+
version: 3.5.0
|
|
78
78
|
- !ruby/object:Gem::Dependency
|
|
79
79
|
name: jeweler
|
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -154,6 +154,7 @@ files:
|
|
|
154
154
|
- test/rails_app/.gitignore
|
|
155
155
|
- test/rails_app/Gemfile
|
|
156
156
|
- test/rails_app/Gemfile.lock
|
|
157
|
+
- test/rails_app/Gemfile.lock.backup
|
|
157
158
|
- test/rails_app/Procfile
|
|
158
159
|
- test/rails_app/README
|
|
159
160
|
- test/rails_app/Rakefile
|
|
@@ -252,7 +253,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
252
253
|
version: '0'
|
|
253
254
|
segments:
|
|
254
255
|
- 0
|
|
255
|
-
hash:
|
|
256
|
+
hash: 245221263
|
|
256
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
258
|
none: false
|
|
258
259
|
requirements:
|