回答編集履歴
1
修正
answer
CHANGED
@@ -8,9 +8,6 @@
|
|
8
8
|
def new
|
9
9
|
@post = Post.new
|
10
10
|
3.times { @post.photos.build }
|
11
|
-
|
12
|
-
# パンくずリスト
|
13
|
-
add_breadcrumb '投稿する', :new_post_path
|
14
11
|
end
|
15
12
|
|
16
13
|
# 投稿の編集フォーム
|
@@ -24,10 +21,6 @@
|
|
24
21
|
elsif @post.photos.count == 0
|
25
22
|
3.times { @post.photos.build }
|
26
23
|
end
|
27
|
-
|
28
|
-
# パンくずリスト
|
29
|
-
add_breadcrumb @post.title, :post_path
|
30
|
-
add_breadcrumb '投稿の編集', :edit_post_path
|
31
24
|
end
|
32
25
|
|
33
26
|
# 投稿の新規作成
|
@@ -49,6 +42,11 @@
|
|
49
42
|
render :edit
|
50
43
|
end
|
51
44
|
end
|
45
|
+
|
46
|
+
private
|
47
|
+
def post_params
|
48
|
+
params.require(:post).permit(:title, :content, :status, photos_attributes: [:id, :image, :_destroy])
|
49
|
+
end
|
52
50
|
```
|
53
51
|
|
54
52
|
```
|