回答編集履歴
1
内容の変更
answer
CHANGED
@@ -1,7 +1,17 @@
|
|
1
1
|
```
|
2
|
+
def create
|
3
|
+
@diary = Diary.find(params[:diary_id])
|
4
|
+
@reply = Reply.new(reply_params)
|
5
|
+
if @reply.save!
|
6
|
+
redirect_to root_path
|
7
|
+
else
|
8
|
+
redirect_to root_path
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
2
14
|
def reply_params
|
3
15
|
params.require(:reply).permit(:reply_text).merge(user_id: current_user.id, diary_id: @diary.id)
|
4
16
|
end
|
5
|
-
```
|
17
|
+
```
|
6
|
-
|
7
|
-
だとどうなるでしょうか?
|