質問編集履歴
3
テストコードを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -184,142 +184,96 @@
|
|
184
184
|
|
185
185
|
```
|
186
186
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
(c
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
expecte
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/finders.rb:52:in `find'
|
282
|
-
|
283
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/actions.rb:58:in `click_button'
|
284
|
-
|
285
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/session.rb:759:in `block (2 levels) in <class:Session>'
|
286
|
-
|
287
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/dsl.rb:58:in `block (2 levels) in <module:DSL>'
|
288
|
-
|
289
|
-
# ./spec/system/users_spec.rb:117:in `block (4 levels) in <top (required)>'
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
8) ユーザーのテスト 編集のテスト 表示の確認 編集に失敗する
|
294
|
-
|
295
|
-
Failure/Error: fill_in 'user[name]', with: ''
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
Capybara::ElementNotFound:
|
300
|
-
|
301
|
-
Unable to find field "user[name]" that is not disabled
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/finders.rb:302:in `block in synced_resolve'
|
310
|
-
|
311
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/base.rb:83:in `synchronize'
|
312
|
-
|
313
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/finders.rb:291:in `synced_resolve'
|
314
|
-
|
315
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/finders.rb:52:in `find'
|
316
|
-
|
317
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/actions.rb:91:in `fill_in'
|
318
|
-
|
319
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/session.rb:759:in `block (2 levels) in <class:Session>'
|
320
|
-
|
321
|
-
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/dsl.rb:58:in `block (2 levels) in <module:DSL>'
|
322
|
-
|
323
|
-
# ./spec/system/users_spec.rb:122:in `block (4 levels) in <top (required)>'
|
324
|
-
|
325
|
-
```
|
187
|
+
system/users_spec.rb
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
describe '編集のテスト' do
|
192
|
+
|
193
|
+
context '自分の編集画面への遷移' do
|
194
|
+
|
195
|
+
it '遷移できる' do
|
196
|
+
|
197
|
+
visit edit_user_path(user)
|
198
|
+
|
199
|
+
expect(current_path).to eq('/users/' + user.id.to_s + '/edit')
|
200
|
+
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
context '他人の編集画面への遷移' do
|
206
|
+
|
207
|
+
it '遷移できない' do
|
208
|
+
|
209
|
+
visit edit_user_path(test_user2)
|
210
|
+
|
211
|
+
expect(current_path).to eq('/users/' + user.id.to_s)
|
212
|
+
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
context '表示の確認' do
|
220
|
+
|
221
|
+
before do
|
222
|
+
|
223
|
+
visit edit_user_path(user)
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'User infoと表示される' do
|
228
|
+
|
229
|
+
expect(page).to have_content('User info')
|
230
|
+
|
231
|
+
end
|
232
|
+
|
233
|
+
it '名前編集フォームに自分の名前が表示される' do
|
234
|
+
|
235
|
+
expect(page).to have_field 'user[name]', with: user.name
|
236
|
+
|
237
|
+
end
|
238
|
+
|
239
|
+
it '画像編集フォームが表示される' do
|
240
|
+
|
241
|
+
expect(page).to have_field 'user[profile_image]'
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
it '自己紹介編集フォームに自分の自己紹介が表示される' do
|
246
|
+
|
247
|
+
expect(page).to have_field 'user[introduction]', with: user.introduction
|
248
|
+
|
249
|
+
end
|
250
|
+
|
251
|
+
it '編集に成功する' do
|
252
|
+
|
253
|
+
click_button 'Update User'
|
254
|
+
|
255
|
+
expect(page).to have_content 'successfully'
|
256
|
+
|
257
|
+
expect(current_path).to eq('/users/' + user.id.to_s)
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
it '編集に失敗する' do
|
262
|
+
|
263
|
+
fill_in 'user[name]', with: ''
|
264
|
+
|
265
|
+
click_button 'Update User'
|
266
|
+
|
267
|
+
expect(page).to have_content 'error'
|
268
|
+
|
269
|
+
#もう少し詳細にエラー文出したい
|
270
|
+
|
271
|
+
expect(current_path).to eq('/users/' + user.id.to_s)
|
272
|
+
|
273
|
+
end
|
274
|
+
|
275
|
+
end
|
276
|
+
|
277
|
+
end
|
278
|
+
|
279
|
+
```
|
2
テストコードを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -124,27 +124,11 @@
|
|
124
124
|
|
125
125
|
rake routes
|
126
126
|
|
127
|
+
|
128
|
+
|
127
|
-
|
129
|
+
~省略~
|
128
|
-
|
129
|
-
|
130
|
+
|
130
|
-
|
131
|
-
|
131
|
+
|
132
|
-
|
133
|
-
destroy_user_session DELETE /users/sign_out(.:format) users/sessions#destroy
|
134
|
-
|
135
|
-
new_user_password GET /users/password/new(.:format) devise/passwords#new
|
136
|
-
|
137
|
-
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
|
138
|
-
|
139
|
-
user_password PATCH /users/password(.:format) devise/passwords#update
|
140
|
-
|
141
|
-
PUT /users/password(.:format) devise/passwords#update
|
142
|
-
|
143
|
-
POST /users/password(.:format) devise/passwords#create
|
144
|
-
|
145
|
-
cancel_user_registration GET /users/cancel(.:format) users/registrations#cancel
|
146
|
-
|
147
|
-
new_user_registration GET /users/sign_up(.:format) users/registrations#new
|
148
132
|
|
149
133
|
edit_user_registration GET /users/edit(.:format) users/registrations#edit
|
150
134
|
|
@@ -192,18 +176,6 @@
|
|
192
176
|
|
193
177
|
DELETE /books/:id(.:format) books#destroy
|
194
178
|
|
195
|
-
refile_app /attachments #<Refile::App app_file="/home/ec2-user/.rvm/gems/ruby-2.6.3/bundler/gems/refile-46b4178654e6/lib/refile/app.rb">
|
196
|
-
|
197
|
-
rails_service_blob GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs#show
|
198
|
-
|
199
|
-
rails_blob_representation GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show
|
200
|
-
|
201
|
-
rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show
|
202
|
-
|
203
|
-
update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update
|
204
|
-
|
205
|
-
rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create
|
206
|
-
|
207
179
|
```
|
208
180
|
|
209
181
|
|
@@ -212,176 +184,142 @@
|
|
212
184
|
|
213
185
|
```
|
214
186
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
cre
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
t.timestamps null: false
|
358
|
-
|
359
|
-
t.string :name
|
360
|
-
|
361
|
-
t.string :introduction
|
362
|
-
|
363
|
-
t.string :profile_image_id
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
end
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
# add_index :users, :username, unique: true
|
374
|
-
|
375
|
-
add_index :users, :email, unique: true
|
376
|
-
|
377
|
-
add_index :users, :reset_password_token, unique: true
|
378
|
-
|
379
|
-
# add_index :users, :confirmation_token, unique: true
|
380
|
-
|
381
|
-
# add_index :users, :unlock_token, unique: true
|
382
|
-
|
383
|
-
end
|
384
|
-
|
385
|
-
end
|
386
|
-
|
387
|
-
```
|
187
|
+
3) ユーザーのテスト 編集のテスト 自分の編集画面への遷移 遷移できる
|
188
|
+
|
189
|
+
Failure/Error: expect(current_path).to eq('/users/' + user.id.to_s + '/edit')
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
expected: "/users/2/edit"
|
194
|
+
|
195
|
+
got: "/users/2"
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
(compared using ==)
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
# ./spec/system/users_spec.rb:90:in `block (4 levels) in <top (required)>'
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
4) ユーザーのテスト 編集のテスト 表示の確認 名前編集フォームに自分の名前が表示される
|
212
|
+
|
213
|
+
Failure/Error: expect(page).to have_field 'user[name]', with: user.name
|
214
|
+
|
215
|
+
expected to find field "user[name]" that is not disabled but there were no matches
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
# ./spec/system/users_spec.rb:108:in `block (4 levels) in <top (required)>'
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
5) ユーザーのテスト 編集のテスト 表示の確認 画像編集フォームが表示される
|
228
|
+
|
229
|
+
Failure/Error: expect(page).to have_field 'user[profile_image]'
|
230
|
+
|
231
|
+
expected to find field "user[profile_image]" that is not disabled but there were no matches
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
# ./spec/system/users_spec.rb:111:in `block (4 levels) in <top (required)>'
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
6) ユーザーのテスト 編集のテスト 表示の確認 自己紹介編集フォームに自分の自己紹介が表示される
|
244
|
+
|
245
|
+
Failure/Error: expect(page).to have_field 'user[introduction]', with: user.introduction
|
246
|
+
|
247
|
+
expected to find field "user[introduction]" that is not disabled but there were no matches
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
# ./spec/system/users_spec.rb:114:in `block (4 levels) in <top (required)>'
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
7) ユーザーのテスト 編集のテスト 表示の確認 編集に成功する
|
260
|
+
|
261
|
+
Failure/Error: click_button 'Update User'
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
Capybara::ElementNotFound:
|
266
|
+
|
267
|
+
Unable to find button "Update User" that is not disabled
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/finders.rb:302:in `block in synced_resolve'
|
276
|
+
|
277
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/base.rb:83:in `synchronize'
|
278
|
+
|
279
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/finders.rb:291:in `synced_resolve'
|
280
|
+
|
281
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/finders.rb:52:in `find'
|
282
|
+
|
283
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/actions.rb:58:in `click_button'
|
284
|
+
|
285
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/session.rb:759:in `block (2 levels) in <class:Session>'
|
286
|
+
|
287
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/dsl.rb:58:in `block (2 levels) in <module:DSL>'
|
288
|
+
|
289
|
+
# ./spec/system/users_spec.rb:117:in `block (4 levels) in <top (required)>'
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
8) ユーザーのテスト 編集のテスト 表示の確認 編集に失敗する
|
294
|
+
|
295
|
+
Failure/Error: fill_in 'user[name]', with: ''
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
Capybara::ElementNotFound:
|
300
|
+
|
301
|
+
Unable to find field "user[name]" that is not disabled
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/finders.rb:302:in `block in synced_resolve'
|
310
|
+
|
311
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/base.rb:83:in `synchronize'
|
312
|
+
|
313
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/finders.rb:291:in `synced_resolve'
|
314
|
+
|
315
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/finders.rb:52:in `find'
|
316
|
+
|
317
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/node/actions.rb:91:in `fill_in'
|
318
|
+
|
319
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/session.rb:759:in `block (2 levels) in <class:Session>'
|
320
|
+
|
321
|
+
# /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/capybara-3.31.0/lib/capybara/dsl.rb:58:in `block (2 levels) in <module:DSL>'
|
322
|
+
|
323
|
+
# ./spec/system/users_spec.rb:122:in `block (4 levels) in <top (required)>'
|
324
|
+
|
325
|
+
```
|
1
コードを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -205,3 +205,183 @@
|
|
205
205
|
rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create
|
206
206
|
|
207
207
|
```
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
【追記】
|
212
|
+
|
213
|
+
```
|
214
|
+
|
215
|
+
user/edit.html.erb
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<div class="user-information">
|
220
|
+
|
221
|
+
<div class="user-information-item">
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
<h2 class="header-space">User info</h2>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<%= form_for(@user) do |f| %>
|
230
|
+
|
231
|
+
<%= render 'layouts/user_edit_error_messages', model: f.object %>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<div class="field user-form user-edit-form">
|
236
|
+
|
237
|
+
<%= f.label :Name %><br/>
|
238
|
+
|
239
|
+
<%= f.text_field :name, autofocus: true, autocomplete: "name" %>
|
240
|
+
|
241
|
+
</div>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
<div class="form-group has-icon user-edit user-form">
|
246
|
+
|
247
|
+
<%= f.label :Image %><br/>
|
248
|
+
|
249
|
+
<%= f.attachment_field :profile_image, placeholder: "Image" %>
|
250
|
+
|
251
|
+
</div>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
<div class="field user-form user-edit-form">
|
256
|
+
|
257
|
+
<%= f.label :Introduction, class: "user-introduction" %><br/>
|
258
|
+
|
259
|
+
<%= f.text_area :introduction, autofocus: true, autocomplete: "introduction" %>
|
260
|
+
|
261
|
+
</div>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
<div class="actions user-form">
|
266
|
+
|
267
|
+
<%= f.submit "Update User" %>
|
268
|
+
|
269
|
+
</div>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
<% end %>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
</div>
|
278
|
+
|
279
|
+
</div>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
<%= render 'shared/footer' %>
|
284
|
+
|
285
|
+
```
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
```
|
290
|
+
|
291
|
+
_devise_create_users.rb
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
# frozen_string_literal: true
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
class DeviseCreateUsers < ActiveRecord::Migration[5.0]
|
300
|
+
|
301
|
+
def change
|
302
|
+
|
303
|
+
create_table :users do |t|
|
304
|
+
|
305
|
+
## Database authenticatable
|
306
|
+
|
307
|
+
t.string :name, null: false, default: ""
|
308
|
+
|
309
|
+
t.string :email, null: false, default: ""
|
310
|
+
|
311
|
+
t.string :password, null: false, default: ""
|
312
|
+
|
313
|
+
t.string :encrypted_password, null: false, default: ""
|
314
|
+
|
315
|
+
## Recoverable
|
316
|
+
|
317
|
+
t.string :reset_password_token
|
318
|
+
|
319
|
+
t.datetime :reset_password_sent_at
|
320
|
+
|
321
|
+
## Rememberable
|
322
|
+
|
323
|
+
t.datetime :remember_created_at
|
324
|
+
|
325
|
+
## Trackable
|
326
|
+
|
327
|
+
t.integer :sign_in_count, default: 0, null: false
|
328
|
+
|
329
|
+
t.datetime :current_sign_in_at
|
330
|
+
|
331
|
+
t.datetime :last_sign_in_at
|
332
|
+
|
333
|
+
t.string :current_sign_in_ip
|
334
|
+
|
335
|
+
t.string :last_sign_in_ip
|
336
|
+
|
337
|
+
## Confirmable
|
338
|
+
|
339
|
+
# t.string :confirmation_token
|
340
|
+
|
341
|
+
# t.datetime :confirmed_at
|
342
|
+
|
343
|
+
# t.datetime :confirmation_sent_at
|
344
|
+
|
345
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
346
|
+
|
347
|
+
## Lockable
|
348
|
+
|
349
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
350
|
+
|
351
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
352
|
+
|
353
|
+
# t.datetime :locked_at
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
t.timestamps null: false
|
358
|
+
|
359
|
+
t.string :name
|
360
|
+
|
361
|
+
t.string :introduction
|
362
|
+
|
363
|
+
t.string :profile_image_id
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
end
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
# add_index :users, :username, unique: true
|
374
|
+
|
375
|
+
add_index :users, :email, unique: true
|
376
|
+
|
377
|
+
add_index :users, :reset_password_token, unique: true
|
378
|
+
|
379
|
+
# add_index :users, :confirmation_token, unique: true
|
380
|
+
|
381
|
+
# add_index :users, :unlock_token, unique: true
|
382
|
+
|
383
|
+
end
|
384
|
+
|
385
|
+
end
|
386
|
+
|
387
|
+
```
|