質問編集履歴
2
コピペのミス
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Cloud9環境でRuby on railsを作業中です。
|
2
2
|
|
3
|
-
ログイン画面が表示されません。
|
3
|
+
以下のように書き込んだのですが、ログイン画面が表示されません。
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -24,87 +24,17 @@
|
|
24
24
|
|
25
25
|
```
|
26
26
|
|
27
|
-
|
27
|
+
Rails.application.routes.draw do
|
28
28
|
|
29
|
-
def
|
29
|
+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
30
30
|
|
31
|
-
|
31
|
+
root "top#index"
|
32
32
|
|
33
|
-
|
33
|
+
devise_for :users
|
34
34
|
|
35
|
-
t.string :email, null: false, default: ""
|
36
|
-
|
37
|
-
|
35
|
+
resources :users
|
38
36
|
|
39
37
|
|
40
|
-
|
41
|
-
## Recoverable
|
42
|
-
|
43
|
-
t.string :reset_password_token
|
44
|
-
|
45
|
-
t.datetime :reset_password_sent_at
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
## Rememberable
|
50
|
-
|
51
|
-
t.datetime :remember_created_at
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
## Trackable
|
56
|
-
|
57
|
-
# t.integer :sign_in_count, default: 0, null: false
|
58
|
-
|
59
|
-
# t.datetime :current_sign_in_at
|
60
|
-
|
61
|
-
# t.datetime :last_sign_in_at
|
62
|
-
|
63
|
-
# t.string :current_sign_in_ip
|
64
|
-
|
65
|
-
# t.string :last_sign_in_ip
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
## Confirmable
|
70
|
-
|
71
|
-
# t.string :confirmation_token
|
72
|
-
|
73
|
-
# t.datetime :confirmed_at
|
74
|
-
|
75
|
-
# t.datetime :confirmation_sent_at
|
76
|
-
|
77
|
-
# t.string :unconfirmed_email # Only if using reconfirmable
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
## Lockable
|
82
|
-
|
83
|
-
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
84
|
-
|
85
|
-
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
86
|
-
|
87
|
-
# t.datetime :locked_at
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
t.timestamps null: false
|
94
|
-
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
add_index :users, :email, unique: true
|
100
|
-
|
101
|
-
add_index :users, :reset_password_token, unique: true
|
102
|
-
|
103
|
-
# add_index :users, :confirmation_token, unique: true
|
104
|
-
|
105
|
-
# add_index :users, :unlock_token, unique: true
|
106
|
-
|
107
|
-
end
|
108
38
|
|
109
39
|
end
|
110
40
|
|
@@ -231,117 +161,3 @@
|
|
231
161
|
end
|
232
162
|
|
233
163
|
```
|
234
|
-
|
235
|
-
**devise_create_users.rb**
|
236
|
-
|
237
|
-
```
|
238
|
-
|
239
|
-
# frozen_string_literal: true
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
class DeviseCreateUsers < ActiveRecord::Migration[5.0]
|
244
|
-
|
245
|
-
def change
|
246
|
-
|
247
|
-
create_table :users do |t|
|
248
|
-
|
249
|
-
## Database authenticatable
|
250
|
-
|
251
|
-
t.string :email, null: false, default: ""
|
252
|
-
|
253
|
-
t.string :encrypted_password, null: false, default: ""
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
## Recoverable
|
258
|
-
|
259
|
-
t.string :reset_password_token
|
260
|
-
|
261
|
-
t.datetime :reset_password_sent_at
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
## Rememberable
|
266
|
-
|
267
|
-
t.datetime :remember_created_at
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
## Trackable
|
272
|
-
|
273
|
-
# t.integer :sign_in_count, default: 0, null: false
|
274
|
-
|
275
|
-
# t.datetime :current_sign_in_at
|
276
|
-
|
277
|
-
# t.datetime :last_sign_in_at
|
278
|
-
|
279
|
-
# t.string :current_sign_in_ip
|
280
|
-
|
281
|
-
# t.string :last_sign_in_ip
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
## Confirmable
|
286
|
-
|
287
|
-
# t.string :confirmation_token
|
288
|
-
|
289
|
-
# t.datetime :confirmed_at
|
290
|
-
|
291
|
-
# t.datetime :confirmation_sent_at
|
292
|
-
|
293
|
-
# t.string :unconfirmed_email # Only if using reconfirmable
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
## Lockable
|
298
|
-
|
299
|
-
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
300
|
-
|
301
|
-
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
302
|
-
|
303
|
-
# t.datetime :locked_at
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
t.timestamps null: false
|
310
|
-
|
311
|
-
end
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
add_index :users, :email, unique: true
|
316
|
-
|
317
|
-
add_index :users, :reset_password_token, unique: true
|
318
|
-
|
319
|
-
# add_index :users, :confirmation_token, unique: true
|
320
|
-
|
321
|
-
# add_index :users, :unlock_token, unique: true
|
322
|
-
|
323
|
-
end
|
324
|
-
|
325
|
-
end
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
```
|
330
|
-
|
331
|
-
**user.rb**
|
332
|
-
|
333
|
-
```
|
334
|
-
|
335
|
-
class User < ApplicationRecord
|
336
|
-
|
337
|
-
# Include default devise modules. Others available are:
|
338
|
-
|
339
|
-
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
340
|
-
|
341
|
-
devise :database_authenticatable, :registerable,
|
342
|
-
|
343
|
-
:recoverable, :rememberable, :validatable
|
344
|
-
|
345
|
-
end
|
346
|
-
|
347
|
-
```
|
1
編集・追記依頼のため
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
gem 'devise'
|
1
|
+
gem 'devise'
|
test
CHANGED
@@ -1,123 +1,347 @@
|
|
1
|
-
Cloud9環境でRuby on
|
1
|
+
Cloud9環境でRuby on railsを作業中です。
|
2
|
+
|
2
|
-
|
3
|
+
ログイン画面が表示されません。
|
3
|
-
|
4
|
-
|
4
|
+
|
5
|
+
|
6
|
+
|
5
|
-
|
7
|
+
**bashへの書き込み**
|
6
|
-
|
7
|
-
|
8
8
|
|
9
9
|
$ bundle install
|
10
10
|
|
11
11
|
$ rails g devise:install
|
12
12
|
|
13
|
-
ののち、
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
config/environments/development.rb に
|
18
|
-
|
19
|
-
config.action_mailer.default_url_options = { protocol: 'https', host: 'https://41a01503f3b94436b1e26c5b65638f97.vfs.cloud9.ap-northeast-1.amazonaws.com/' }
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
app/views/layouts/application.html.erbに
|
24
|
-
|
25
|
-
<% if flash[:notice] %>
|
26
|
-
|
27
|
-
<p><%= flash[:notice] %></p>
|
28
|
-
|
29
|
-
<% end %>
|
30
|
-
|
31
|
-
<% if flash[:alert] %>
|
32
|
-
|
33
|
-
<p><%= flash[:alert] %></p>
|
34
|
-
|
35
|
-
<% end %>
|
36
|
-
|
37
|
-
を追加しました。
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
その後、
|
42
|
-
|
43
13
|
$ rails g devise:views
|
44
14
|
|
45
15
|
$ rails g devise User
|
46
16
|
|
47
|
-
```ここに言語を入力
|
48
|
-
|
49
|
-
ec2-user:~/environment/techpit-match $ rails g devise User
|
50
|
-
|
51
|
-
Running via Spring preloader in process 5929
|
52
|
-
|
53
|
-
Deprecation warning: Expected boolean default value for '--orm'; got :active_record (string).
|
54
|
-
|
55
|
-
This will be rejected in the future unless you explicitly pass the options `check_default_type: false` or call `allow_incompatible_default_type!` in your code
|
56
|
-
|
57
|
-
You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.
|
58
|
-
|
59
|
-
invoke active_record
|
60
|
-
|
61
|
-
create db/migrate/20200822074735_devise_create_users.rb
|
62
|
-
|
63
|
-
create app/models/user.rb
|
64
|
-
|
65
|
-
invoke test_unit
|
66
|
-
|
67
|
-
create test/models/user_test.rb
|
68
|
-
|
69
|
-
create test/fixtures/users.yml
|
70
|
-
|
71
|
-
insert app/models/user.rb
|
72
|
-
|
73
|
-
route devise_for :users
|
74
|
-
|
75
|
-
```
|
76
|
-
|
77
17
|
$ rails db:migrate
|
78
18
|
|
79
|
-
$ rails s
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
```
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
19
|
+
$ rails s
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
**routes.rb**
|
24
|
+
|
25
|
+
```
|
26
|
+
|
27
|
+
class DeviseCreateUsers < ActiveRecord::Migration[5.0]
|
28
|
+
|
29
|
+
def change
|
30
|
+
|
31
|
+
create_table :users do |t|
|
32
|
+
|
33
|
+
## Database authenticatable
|
34
|
+
|
35
|
+
t.string :email, null: false, default: ""
|
36
|
+
|
37
|
+
t.string :encrypted_password, null: false, default: ""
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
## Recoverable
|
42
|
+
|
43
|
+
t.string :reset_password_token
|
44
|
+
|
45
|
+
t.datetime :reset_password_sent_at
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
## Rememberable
|
50
|
+
|
51
|
+
t.datetime :remember_created_at
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
## Trackable
|
56
|
+
|
57
|
+
# t.integer :sign_in_count, default: 0, null: false
|
58
|
+
|
59
|
+
# t.datetime :current_sign_in_at
|
60
|
+
|
61
|
+
# t.datetime :last_sign_in_at
|
62
|
+
|
63
|
+
# t.string :current_sign_in_ip
|
64
|
+
|
65
|
+
# t.string :last_sign_in_ip
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
## Confirmable
|
70
|
+
|
71
|
+
# t.string :confirmation_token
|
72
|
+
|
73
|
+
# t.datetime :confirmed_at
|
74
|
+
|
75
|
+
# t.datetime :confirmation_sent_at
|
76
|
+
|
77
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
## Lockable
|
82
|
+
|
83
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
84
|
+
|
85
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
86
|
+
|
87
|
+
# t.datetime :locked_at
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
t.timestamps null: false
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
add_index :users, :email, unique: true
|
100
|
+
|
101
|
+
add_index :users, :reset_password_token, unique: true
|
102
|
+
|
103
|
+
# add_index :users, :confirmation_token, unique: true
|
104
|
+
|
105
|
+
# add_index :users, :unlock_token, unique: true
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
```
|
114
|
+
|
115
|
+
**development.rb**
|
116
|
+
|
117
|
+
```
|
118
|
+
|
119
|
+
Rails.application.configure do
|
120
|
+
|
121
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
# In the development environment your application's code is reloaded on
|
126
|
+
|
127
|
+
# every request. This slows down response time but is perfect for development
|
128
|
+
|
129
|
+
# since you don't have to restart the web server when you make code changes.
|
130
|
+
|
131
|
+
config.cache_classes = false
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
# Do not eager load code on boot.
|
136
|
+
|
137
|
+
config.eager_load = false
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
# Show full error reports.
|
142
|
+
|
143
|
+
config.consider_all_requests_local = true
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
# Enable/disable caching. By default caching is disabled.
|
148
|
+
|
149
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
150
|
+
|
151
|
+
config.action_controller.perform_caching = true
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
config.cache_store = :memory_store
|
156
|
+
|
157
|
+
config.public_file_server.headers = {
|
158
|
+
|
159
|
+
'Cache-Control' => 'public, max-age=172800'
|
160
|
+
|
161
|
+
}
|
162
|
+
|
163
|
+
else
|
164
|
+
|
165
|
+
config.action_controller.perform_caching = false
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
config.cache_store = :null_store
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
# Don't care if the mailer can't send.
|
176
|
+
|
177
|
+
config.action_mailer.raise_delivery_errors = false
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
config.action_mailer.perform_caching = false
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
# Print deprecation notices to the Rails logger.
|
186
|
+
|
187
|
+
config.active_support.deprecation = :log
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
# Raise an error on page load if there are pending migrations.
|
192
|
+
|
193
|
+
config.active_record.migration_error = :page_load
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
198
|
+
|
199
|
+
# This option may cause significant delays in view rendering with a large
|
200
|
+
|
201
|
+
# number of complex assets.
|
202
|
+
|
203
|
+
config.assets.debug = true
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
# Suppress logger output for asset requests.
|
208
|
+
|
209
|
+
config.assets.quiet = true
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
# Raises error for missing translations
|
214
|
+
|
215
|
+
# config.action_view.raise_on_missing_translations = true
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
220
|
+
|
221
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
222
|
+
|
223
|
+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
102
224
|
|
103
225
|
|
104
226
|
|
227
|
+
config.action_mailer.default_url_options = { protocol: 'https', host: 'https://41a01503f3b94436b1e26c5b65638f97.vfs.cloud9.ap-northeast-1.amazonaws.com/' }
|
228
|
+
|
229
|
+
|
230
|
+
|
105
231
|
end
|
106
232
|
|
107
|
-
|
108
|
-
|
109
|
-
Rails.root: /home/ec2-user/environment/techpit-match
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
Application Trace | Framework Trace | Full Trace
|
114
|
-
|
115
|
-
config/routes.rb:4:in `block in <top (required)>'
|
116
|
-
|
117
|
-
config/routes.rb:1:in `<top (required)>'
|
118
|
-
|
119
|
-
This error occurred while loading the following files:
|
120
|
-
|
121
|
-
/home/ec2-user/environment/techpit-match/config/routes.rb
|
122
|
-
|
123
|
-
```
|
233
|
+
```
|
234
|
+
|
235
|
+
**devise_create_users.rb**
|
236
|
+
|
237
|
+
```
|
238
|
+
|
239
|
+
# frozen_string_literal: true
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
class DeviseCreateUsers < ActiveRecord::Migration[5.0]
|
244
|
+
|
245
|
+
def change
|
246
|
+
|
247
|
+
create_table :users do |t|
|
248
|
+
|
249
|
+
## Database authenticatable
|
250
|
+
|
251
|
+
t.string :email, null: false, default: ""
|
252
|
+
|
253
|
+
t.string :encrypted_password, null: false, default: ""
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
## Recoverable
|
258
|
+
|
259
|
+
t.string :reset_password_token
|
260
|
+
|
261
|
+
t.datetime :reset_password_sent_at
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
## Rememberable
|
266
|
+
|
267
|
+
t.datetime :remember_created_at
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
## Trackable
|
272
|
+
|
273
|
+
# t.integer :sign_in_count, default: 0, null: false
|
274
|
+
|
275
|
+
# t.datetime :current_sign_in_at
|
276
|
+
|
277
|
+
# t.datetime :last_sign_in_at
|
278
|
+
|
279
|
+
# t.string :current_sign_in_ip
|
280
|
+
|
281
|
+
# t.string :last_sign_in_ip
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
## Confirmable
|
286
|
+
|
287
|
+
# t.string :confirmation_token
|
288
|
+
|
289
|
+
# t.datetime :confirmed_at
|
290
|
+
|
291
|
+
# t.datetime :confirmation_sent_at
|
292
|
+
|
293
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
## Lockable
|
298
|
+
|
299
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
300
|
+
|
301
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
302
|
+
|
303
|
+
# t.datetime :locked_at
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
t.timestamps null: false
|
310
|
+
|
311
|
+
end
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
add_index :users, :email, unique: true
|
316
|
+
|
317
|
+
add_index :users, :reset_password_token, unique: true
|
318
|
+
|
319
|
+
# add_index :users, :confirmation_token, unique: true
|
320
|
+
|
321
|
+
# add_index :users, :unlock_token, unique: true
|
322
|
+
|
323
|
+
end
|
324
|
+
|
325
|
+
end
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
```
|
330
|
+
|
331
|
+
**user.rb**
|
332
|
+
|
333
|
+
```
|
334
|
+
|
335
|
+
class User < ApplicationRecord
|
336
|
+
|
337
|
+
# Include default devise modules. Others available are:
|
338
|
+
|
339
|
+
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
340
|
+
|
341
|
+
devise :database_authenticatable, :registerable,
|
342
|
+
|
343
|
+
:recoverable, :rememberable, :validatable
|
344
|
+
|
345
|
+
end
|
346
|
+
|
347
|
+
```
|