回答編集履歴

1

情報追加

2020/01/08 02:21

投稿

winterboum
winterboum

スコア23358

test CHANGED
@@ -3,3 +3,17 @@
3
3
  redirect_to post_image_path(post_image) で終わっているので、post_imageの詳細に行ってます。
4
4
 
5
5
  ここを post_images_path 複数形 のに変えてみてください
6
+
7
+
8
+
9
+ 追加情報
10
+
11
+ 3つ方法があります。
12
+
13
+ 1) ブラウザーからのリクエストヘッダーにどのURLからきたか、という情報があります。それを読んで変える
14
+
15
+ 2) link_to post_image_favorites_path(post_image) にさらに
16
+
17
+ link_to post_image_favorites_path(post_image,from: :index), とか from: :new とかをつけて parms[:from] で分ける
18
+
19
+ 3) indexから呼ぶときは別のactionで作る。