質問編集履歴

2

修正

2017/05/14 21:19

投稿

imamoto_browser
imamoto_browser

スコア1161

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  $errors = [
26
26
 
27
- 'email' => ['E-mail must be valid']
27
+ 'detail' => ['please enter detail.']
28
28
 
29
29
  ];
30
30
 

1

追記

2017/05/14 21:19

投稿

imamoto_browser
imamoto_browser

スコア1161

test CHANGED
File without changes
test CHANGED
@@ -57,3 +57,15 @@
57
57
 
58
58
 
59
59
  バリデーションルールに適合しない入力がなされた場合、エラーメッセージをhtml5の標準のバリデーションのような形で表示したいのですが、controller側でどのようにかけばよろしいでしょうか。
60
+
61
+
62
+
63
+ 追記:ちなみにnewEntityが呼ばれたタイミングでバリデーションが走って、バリデーションエラーなら、
64
+
65
+ ```php
66
+
67
+ if ($article->errors()) {
68
+
69
+ ```
70
+
71
+ の判定がtrueになると思うのですが、いかがでしょうか。