質問編集履歴

2

誤字

2019/08/11 09:59

投稿

sasamo2000
sasamo2000

スコア15

test CHANGED
File without changes
test CHANGED
@@ -58,7 +58,7 @@
58
58
 
59
59
  //内容を追加し保存
60
60
 
61
- cerate=Create.new(content:"~", comment:"~", judgement:"~")
61
+ create=Create.new(content:"~", comment:"~", judgement:"~")
62
62
 
63
63
  create.save
64
64
 

1

commandの具体的な操作内容を追加

2019/08/11 09:59

投稿

sasamo2000
sasamo2000

スコア15

test CHANGED
File without changes
test CHANGED
@@ -1,5 +1,3 @@
1
- 問題文にcontent
2
-
3
1
  解説文にcomment
4
2
 
5
3
  合否判定の要素にjudgement
@@ -20,7 +18,7 @@
20
18
 
21
19
  ↓モデルを作成した際のファイルです。
22
20
 
23
- ```commandにより作成されたmigrationファイル
21
+ ```ruby
24
22
 
25
23
  class CreateQuestions < ActiveRecord::Migration[5.2]
26
24
 
@@ -45,3 +43,31 @@
45
43
  end
46
44
 
47
45
  ```
46
+
47
+
48
+
49
+ ```command
50
+
51
+ //モデルを作成
52
+
53
+ rails g model create content:text comment:text judgement:text
54
+
55
+ rails db:migrate
56
+
57
+
58
+
59
+ //内容を追加し保存
60
+
61
+ cerate=Create.new(content:"~", comment:"~", judgement:"~")
62
+
63
+ create.save
64
+
65
+
66
+
67
+ //中身を確認
68
+
69
+ rails console
70
+
71
+ crate.valid
72
+
73
+ ```