質問編集履歴

4

c

2017/10/06 13:05

投稿

pecchan
pecchan

スコア555

test CHANGED
@@ -1 +1 @@
1
- 【RoR】呼び出し元が複数ある場合コントローラは1つで処理するか、分けるべき
1
+ 【RoR】リダイレクト先が複数ある場合の方法は?あるいはコントローラ分けるべき
test CHANGED
File without changes

3

っb

2017/10/06 13:05

投稿

pecchan
pecchan

スコア555

test CHANGED
File without changes
test CHANGED
@@ -46,18 +46,20 @@
46
46
 
47
47
  ```
48
48
 
49
+
50
+
51
+ すでに作成済みのコメント入力画面、
52
+
53
+ 今回作成するコメント専用画面
54
+
49
- リダイレクトしたい先が違うわけです
55
+ と、リダイレクト先が2つになりました。
50
56
 
51
57
 
52
58
 
53
- このような場合、コンローラから一式用意するのは無駄ですし。
59
+ このような場合、リダイレク先を
54
-
55
-
56
60
 
57
61
  どのような方法で振り分けるでしょうか?
58
62
 
59
63
 
60
64
 
61
-
62
-
63
- 宜しくお願い致します。
65
+ 良い方法や、アドバイスあれば宜しくお願い致します。

2

aa

2017/10/06 13:04

投稿

pecchan
pecchan

スコア555

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,6 @@
1
1
  Ruby on Rails 5で開発してます。
2
+
3
+ RoRに限った話ではないのでCakePHPもタグ付けしました。
2
4
 
3
5
 
4
6
 
@@ -32,7 +34,7 @@
32
34
 
33
35
  def update
34
36
 
35
- @impression = Blog.find(params[:comment][:action_impression_id])
37
+ @blog = Blog.find(params[:comment][:blog_id])
36
38
 
37
39
  @comment = Comment.find(params[:comment][:id])
38
40
 
@@ -52,11 +54,9 @@
52
54
 
53
55
 
54
56
 
55
- どのような方法で振り分けるでしょうか?
57
+ どのような方法で振り分けるでしょうか?
56
58
 
57
59
 
58
-
59
- RoRに限った話ではないのでCakePHPもタグ付けしました。
60
60
 
61
61
 
62
62
 

1

途中でpostされた

2017/10/06 13:01

投稿

pecchan
pecchan

スコア555

test CHANGED
File without changes
test CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  を使おうと進めてましたが、
24
24
 
25
- 最後のレンダリングで行き詰まってます。
25
+ 最後のリダイクトで行き詰まってます。
26
26
 
27
27
 
28
28
 
@@ -32,14 +32,32 @@
32
32
 
33
33
  def update
34
34
 
35
- @impression = ActionImpression.find(params[:comment][:action_impression_id])
35
+ @impression = Blog.find(params[:comment][:action_impression_id])
36
36
 
37
37
  @comment = Comment.find(params[:comment][:id])
38
38
 
39
39
  @comment.update(post_params)
40
40
 
41
- redirect_to action_impressions_edit_path(date: @impression.imp_date, employee_id: @impression.employee_id)
41
+ redirect_to blog_edit_path(date: @blog.imp_date,employee_id:@blog.employee_id)
42
42
 
43
43
  end
44
44
 
45
45
  ```
46
+
47
+ リダイレクトしたい先が違うわけです。
48
+
49
+
50
+
51
+ このような場合、コントローラから一式用意するのは無駄ですし。
52
+
53
+
54
+
55
+ どのような方法で振り分けるのでしょうか?
56
+
57
+
58
+
59
+ RoRに限った話ではないのでCakePHPもタグ付けしました。
60
+
61
+
62
+
63
+ 宜しくお願い致します。