質問編集履歴
3
コード追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -90,7 +90,29 @@
|
|
90
90
|
|
91
91
|
```
|
92
92
|
|
93
|
-
```ここに言語を入力
|
93
|
+
```ここに言語を入力
|
94
|
+
|
95
|
+
コード db/migrate/~~~~_create_messages.rb
|
96
|
+
|
97
|
+
class CreateMessages < ActiveRecord::Migration[5.2]
|
98
|
+
|
99
|
+
def change
|
100
|
+
|
101
|
+
create_table :messages do |t|
|
102
|
+
|
103
|
+
t.string :content
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
t.timestamps
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
```/``ここに言語を入力``
|
94
116
|
|
95
117
|
|
96
118
|
|
2
エラー追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -29,6 +29,16 @@
|
|
29
29
|
<%= render @messages %>
|
30
30
|
|
31
31
|
</div>
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
エラーメッセージ NameError in Rooms#J-pops
|
36
|
+
|
37
|
+
undefined local variable or method `message' for #<#<Class:0x00007fd73907b620>:0x00007fd737f93bf0>
|
38
|
+
|
39
|
+
<p><%= message.content %></p>
|
40
|
+
|
41
|
+
|
32
42
|
|
33
43
|
```
|
34
44
|
|
1
コード追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,13 +22,7 @@
|
|
22
22
|
|
23
23
|
```
|
24
24
|
|
25
|
-
エラーメッセージ
|
26
|
-
|
27
|
-
|
25
|
+
エラーメッセージ nil' is not an ActiveModel-compatible object. It must implement :to_partial_path.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
### 該当のソースコード
|
32
26
|
|
33
27
|
<div id="messages">
|
34
28
|
|
@@ -36,11 +30,57 @@
|
|
36
30
|
|
37
31
|
</div>
|
38
32
|
|
33
|
+
```
|
34
|
+
|
35
|
+
### 該当のソースコード
|
36
|
+
|
37
|
+
|
38
|
+
|
39
39
|
```ここに言語名を入力
|
40
40
|
|
41
|
+
ソースコード app/views/rooms/J-pops.html.erb
|
42
|
+
|
43
|
+
<div class="rooms-name">
|
44
|
+
|
45
|
+
<h1>J-pops Room</h1>
|
46
|
+
|
41
|
-
|
47
|
+
</div>
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
<div id="messages">
|
52
|
+
|
53
|
+
<%= render @messages %>
|
54
|
+
|
55
|
+
</div>
|
42
56
|
|
43
57
|
```
|
58
|
+
|
59
|
+
```ここに言語を入力
|
60
|
+
|
61
|
+
コード app/views/messages/_message.html.erb
|
62
|
+
|
63
|
+
<p><%= message.content %></p>
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
```ここに言語を入力
|
68
|
+
|
69
|
+
コード app/controllers/rooms_controller.rb
|
70
|
+
|
71
|
+
class RoomsController < ApplicationController
|
72
|
+
|
73
|
+
def rooms
|
74
|
+
|
75
|
+
@messages = Message.all
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
```
|
82
|
+
|
83
|
+
```ここに言語を入力``
|
44
84
|
|
45
85
|
|
46
86
|
|