質問編集履歴
7
test_helper.rb, users.ymlの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -314,6 +314,8 @@
|
|
314
314
|
|
315
315
|
### schema.rb
|
316
316
|
|
317
|
+
```
|
318
|
+
|
317
319
|
|
318
320
|
|
319
321
|
ActiveRecord::Schema.define(version: 20191205081943) do
|
@@ -382,9 +384,85 @@
|
|
382
384
|
|
383
385
|
end
|
384
386
|
|
385
|
-
|
386
|
-
|
387
|
-
```
|
387
|
+
```
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
### test_helper.rb
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
```
|
400
|
+
|
401
|
+
ENV['RAILS_ENV'] ||= 'test'
|
402
|
+
|
403
|
+
require File.expand_path('../../config/environment', __FILE__)
|
404
|
+
|
405
|
+
require 'rails/test_help'
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
class ActiveSupport::TestCase
|
410
|
+
|
411
|
+
Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
412
|
+
|
413
|
+
fixtures :all
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
Add more helper methods to be used by all tests here...
|
418
|
+
|
419
|
+
end
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
```
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
### users.yml
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
```
|
432
|
+
|
433
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
# This model initially had no columns defined. If you add columns to the
|
438
|
+
|
439
|
+
# model remove the '{}' from the fixture names and add the columns immediately
|
440
|
+
|
441
|
+
# below each fixture, per the syntax in the comments below
|
442
|
+
|
443
|
+
#
|
444
|
+
|
445
|
+
one: {}
|
446
|
+
|
447
|
+
# column: value
|
448
|
+
|
449
|
+
#
|
450
|
+
|
451
|
+
two: {}
|
452
|
+
|
453
|
+
# column: value
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
```
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
388
466
|
|
389
467
|
|
390
468
|
|
6
schema.rbの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -314,14 +314,6 @@
|
|
314
314
|
|
315
315
|
### schema.rb
|
316
316
|
|
317
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
318
|
-
|
319
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
320
|
-
|
321
|
-
#
|
322
|
-
|
323
|
-
# It's strongly recommended that you check this file into your version control system.
|
324
|
-
|
325
317
|
|
326
318
|
|
327
319
|
ActiveRecord::Schema.define(version: 20191205081943) do
|
5
schema.rbの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -312,6 +312,90 @@
|
|
312
312
|
|
313
313
|
|
314
314
|
|
315
|
+
### schema.rb
|
316
|
+
|
317
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
318
|
+
|
319
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
320
|
+
|
321
|
+
#
|
322
|
+
|
323
|
+
# It's strongly recommended that you check this file into your version control system.
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
ActiveRecord::Schema.define(version: 20191205081943) do
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
create_table "articles", force: :cascade do |t|
|
332
|
+
|
333
|
+
t.string "title"
|
334
|
+
|
335
|
+
t.text "body"
|
336
|
+
|
337
|
+
t.datetime "created_at", null: false
|
338
|
+
|
339
|
+
t.datetime "updated_at", null: false
|
340
|
+
|
341
|
+
t.integer "user_id"
|
342
|
+
|
343
|
+
t.string "image_id"
|
344
|
+
|
345
|
+
t.index ["user_id"], name: "index_articles_on_user_id"
|
346
|
+
|
347
|
+
end
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
create_table "profiles", force: :cascade do |t|
|
352
|
+
|
353
|
+
t.integer "user_id"
|
354
|
+
|
355
|
+
t.string "name", default: "", null: false
|
356
|
+
|
357
|
+
t.datetime "created_at", null: false
|
358
|
+
|
359
|
+
t.datetime "updated_at", null: false
|
360
|
+
|
361
|
+
t.index ["user_id"], name: "index_profiles_on_user_id"
|
362
|
+
|
363
|
+
end
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
create_table "users", force: :cascade do |t|
|
368
|
+
|
369
|
+
t.string "email", default: "", null: false
|
370
|
+
|
371
|
+
t.string "encrypted_password", default: "", null: false
|
372
|
+
|
373
|
+
t.string "reset_password_token"
|
374
|
+
|
375
|
+
t.datetime "reset_password_sent_at"
|
376
|
+
|
377
|
+
t.datetime "remember_created_at"
|
378
|
+
|
379
|
+
t.datetime "created_at", null: false
|
380
|
+
|
381
|
+
t.datetime "updated_at", null: false
|
382
|
+
|
383
|
+
t.index ["email"], name: "index_users_on_email", unique: true
|
384
|
+
|
385
|
+
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
386
|
+
|
387
|
+
end
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
end
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
```
|
396
|
+
|
397
|
+
|
398
|
+
|
315
399
|
|
316
400
|
|
317
401
|
### 補足情報(FW/ツールのバージョンなど)
|
4
test.sqlite3の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -262,6 +262,56 @@
|
|
262
262
|
|
263
263
|
|
264
264
|
|
265
|
+
### test.sqlite3
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
```ここに言語名を入力
|
270
|
+
|
271
|
+
SQLite format 3@
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
-�)���
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
���<���k�)tablearticlesarticlesCREATE TABLE "articles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "body" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "user_id" integer, "image_id" varchar)P++Ytablesqlite_sequencesqlite_sequenceCREATE TABLE sqlite_sequence(name,seq)p?�indexindex_articles_on_user_idarticlesCREATE INDEX "index_articles_on_user_id" ON "articles" ("user_id")�]�
|
280
|
+
|
281
|
+
tableprofilesprofilesCREATE TABLE "profiles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "name" varchar DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)p?�indexindex_profiles_on_user_idprofilesCREATE INDEX "index_profiles_on_user_id" ON "profiles" ("user_id")
|
282
|
+
|
283
|
+
��k�W�
|
284
|
+
|
285
|
+
tableusersusersCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar DEFAULT '' NOT NULL, "encrypted_password" varchar DEFAULT '' NOT NULL, "reset_password_token" varchar, "reset_password_sent_at" datetime, "remember_created_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)e5�indexindex_users_on_emailusers
|
286
|
+
|
287
|
+
CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")�S�Gindexindex_users_on_reset_password_tokenusersCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
�������)20191204031155)20191202103026)20191204030243)20191204152522)20191204022005)20191205081943
|
294
|
+
|
295
|
+
�������)20191204031155)20191202103026)20191204030243)20191204152522)20191204022005) 20191205081943
|
296
|
+
|
297
|
+
��QH#AAenvironmenttest2019-12-25 12:08:45.7202332019-12-25 12:08:45.727612
|
298
|
+
|
299
|
+
��# environment
|
300
|
+
|
301
|
+
))���x //�tableschema_migrationsschema_migrationsCREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)A
|
302
|
+
|
303
|
+
U/indexsqlite_autoindex_schema_migrations_1schema_migrations
|
304
|
+
|
305
|
+
�N55�?tablear_internal_metadataar_internal_metadataCREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)G[5indexsqlite_autoindex_ar_internal_metadata_1ar_internal_metadata
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
```
|
312
|
+
|
313
|
+
|
314
|
+
|
265
315
|
|
266
316
|
|
267
317
|
### 補足情報(FW/ツールのバージョンなど)
|
3
databaseを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -198,6 +198,70 @@
|
|
198
198
|
|
199
199
|
|
200
200
|
|
201
|
+
### database.yml
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
```ここに言語名を入力
|
206
|
+
|
207
|
+
# SQLite version 3.x
|
208
|
+
|
209
|
+
# gem install sqlite3
|
210
|
+
|
211
|
+
#
|
212
|
+
|
213
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
214
|
+
|
215
|
+
# gem 'sqlite3'
|
216
|
+
|
217
|
+
#
|
218
|
+
|
219
|
+
default: &default
|
220
|
+
|
221
|
+
adapter: sqlite3
|
222
|
+
|
223
|
+
pool: 5
|
224
|
+
|
225
|
+
timeout: 5000
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
development:
|
230
|
+
|
231
|
+
<<: *default
|
232
|
+
|
233
|
+
database: db/development.sqlite3
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
# Warning: The database defined as "test" will be erased and
|
238
|
+
|
239
|
+
# re-generated from your development database when you run "rake".
|
240
|
+
|
241
|
+
# Do not set this db to the same as development or production.
|
242
|
+
|
243
|
+
test:
|
244
|
+
|
245
|
+
<<: *default
|
246
|
+
|
247
|
+
database: db/test.sqlite3
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
production:
|
252
|
+
|
253
|
+
<<: *default
|
254
|
+
|
255
|
+
database: db/production.sqlite3
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
```
|
262
|
+
|
263
|
+
|
264
|
+
|
201
265
|
|
202
266
|
|
203
267
|
### 補足情報(FW/ツールのバージョンなど)
|
2
articles.ymlを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -168,6 +168,36 @@
|
|
168
168
|
|
169
169
|
|
170
170
|
|
171
|
+
### articles.yml
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
```ここに言語名を入力
|
176
|
+
|
177
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
one:
|
182
|
+
|
183
|
+
title: MyString
|
184
|
+
|
185
|
+
body: MyText
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
two:
|
190
|
+
|
191
|
+
title: MyString
|
192
|
+
|
193
|
+
body: MyText
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
```
|
198
|
+
|
199
|
+
|
200
|
+
|
171
201
|
|
172
202
|
|
173
203
|
### 補足情報(FW/ツールのバージョンなど)
|
1
user.rbを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -132,6 +132,42 @@
|
|
132
132
|
|
133
133
|
|
134
134
|
|
135
|
+
### user.rb
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
```ここに言語名を入力
|
140
|
+
|
141
|
+
class User < ApplicationRecord
|
142
|
+
|
143
|
+
# Include default devise modules. Others available are:
|
144
|
+
|
145
|
+
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
146
|
+
|
147
|
+
devise :database_authenticatable, :registerable,
|
148
|
+
|
149
|
+
:recoverable, :rememberable, :validatable
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
has_one :profile, dependent: :destroy
|
154
|
+
|
155
|
+
has_many :articles, dependent: :destroy
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
delegate :name, to: :profile
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
```
|
168
|
+
|
169
|
+
|
170
|
+
|
135
171
|
|
136
172
|
|
137
173
|
### 補足情報(FW/ツールのバージョンなど)
|