質問編集履歴
5
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -112,17 +112,33 @@
|
|
112
112
|
|
113
113
|
# コメントに返信するフォーム(Posts/show)
|
114
114
|
|
115
|
-
- @post.comments.e
|
115
|
+
- if @post.comments.present?
|
116
116
|
|
117
|
-
|
117
|
+
- @post.comments.each do |comment|
|
118
118
|
|
119
|
-
p
|
119
|
+
p.commenter_name = comment.user.try(:name)
|
120
120
|
|
121
|
-
|
121
|
+
p.comment.content = comment.content
|
122
122
|
|
123
|
-
p
|
123
|
+
- comment.replies.each do |reply|
|
124
124
|
|
125
|
+
p.comment.content = reply.content
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
= form_for [:reply, @post, comment], method: :post do |form|
|
130
|
+
|
131
|
+
p
|
132
|
+
|
133
|
+
= form.text_area "content", rows: 3, cols: 35
|
134
|
+
|
135
|
+
p
|
136
|
+
|
125
|
-
= form.submit "上記の内容で返信する"
|
137
|
+
= form.submit "上記の内容で返信する"
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
# ここの実装も良く分かりません。。。
|
126
142
|
|
127
143
|
```
|
128
144
|
|
4
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -110,7 +110,7 @@
|
|
110
110
|
|
111
111
|
```
|
112
112
|
|
113
|
-
# コメントに返信するフォーム
|
113
|
+
# コメントに返信するフォーム(Posts/show)
|
114
114
|
|
115
115
|
- @post.comments.each do |comment|
|
116
116
|
|
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -112,15 +112,17 @@
|
|
112
112
|
|
113
113
|
# コメントに返信するフォーム
|
114
114
|
|
115
|
-
|
115
|
+
- @post.comments.each do |comment|
|
116
116
|
|
117
|
-
p
|
117
|
+
= form_for [:reply, @post, comment], method: :post do |form|
|
118
118
|
|
119
|
-
|
119
|
+
p
|
120
120
|
|
121
|
-
p
|
121
|
+
= form.text_area :content, rows: 3, cols: 35, placeholder: "返信する"
|
122
122
|
|
123
|
+
p
|
124
|
+
|
123
|
-
= form.submit "上記の内容で返信する"
|
125
|
+
= form.submit "上記の内容で返信する"
|
124
126
|
|
125
127
|
```
|
126
128
|
|
2
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -108,6 +108,48 @@
|
|
108
108
|
|
109
109
|
|
110
110
|
|
111
|
+
```
|
112
|
+
|
113
|
+
# コメントに返信するフォーム
|
114
|
+
|
115
|
+
= form_for [:reply, @post, comment], method: :post do |form|
|
116
|
+
|
117
|
+
p
|
118
|
+
|
119
|
+
= form.text_area :content, rows: 3, cols: 35, placeholder: "返信する"
|
120
|
+
|
121
|
+
p
|
122
|
+
|
123
|
+
= form.submit "上記の内容で返信する"
|
124
|
+
|
125
|
+
```
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
```
|
132
|
+
|
133
|
+
routes.rb
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
resources :posts do
|
138
|
+
|
139
|
+
resources :comments, only: [:create, :edit, :update, :destroy] do
|
140
|
+
|
141
|
+
member do
|
142
|
+
|
143
|
+
post :reply
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
```
|
152
|
+
|
111
153
|
|
112
154
|
|
113
155
|
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -94,6 +94,8 @@
|
|
94
94
|
|
95
95
|
|
96
96
|
|
97
|
+
# コメントに返信
|
98
|
+
|
97
99
|
def reply
|
98
100
|
|
99
101
|
# ここの実装がよく分かりません
|