質問編集履歴
6
スペルミスを修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def create
|
27
|
-
@
|
27
|
+
@group = Group.new(group_params)
|
28
28
|
if @group.save(context: :register)
|
29
29
|
redirect_to groups_path
|
30
30
|
else
|
5
RailsのPull Requestで見つけた情報を追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -49,4 +49,11 @@
|
|
49
49
|
関連モデルだけ保存するときにもバリデーションが必要ですので、
|
50
50
|
バリデーションの定義が分散してしまう可能性があります。
|
51
51
|
|
52
|
-
もし何か良い方法があれば、ご教示いただけると幸いです。
|
52
|
+
もし何か良い方法があれば、ご教示いただけると幸いです。
|
53
|
+
|
54
|
+
## 追記
|
55
|
+
|
56
|
+
GithubのrailsのPull Requestで見つけたのですが、
|
57
|
+
もしかしたら新しいRailsのバージョンでは既に修正されている可能性がありそうです。
|
58
|
+
|
59
|
+
[add forward_validation_context flag to AssociatedValidator](https://github.com/rails/rails/pull/24135)
|
4
コロンの抜けを修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
|
26
26
|
def create
|
27
27
|
@gruop = Group.new(group_params)
|
28
|
-
if @group.save(context: register)
|
28
|
+
if @group.save(context: :register)
|
29
29
|
redirect_to groups_path
|
30
30
|
else
|
31
31
|
render :new
|
3
contextを追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,6 +25,7 @@
|
|
25
25
|
|
26
26
|
def create
|
27
27
|
@gruop = Group.new(group_params)
|
28
|
+
if @group.save(context: register)
|
28
29
|
redirect_to groups_path
|
29
30
|
else
|
30
31
|
render :new
|
2
コードの間違いを修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -24,8 +24,7 @@
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def create
|
27
|
-
@gruop = Group.new(
|
27
|
+
@gruop = Group.new(group_params)
|
28
|
-
if @gruop.save(context: :register)
|
29
28
|
redirect_to groups_path
|
30
29
|
else
|
31
30
|
render :new
|
1
タイトルを修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Railsでaccepts_nested_attributes_for
|
1
|
+
Railsでaccepts_nested_attributes_forの使用時に関連モデルにcontextが効かない
|
body
CHANGED
File without changes
|