我的表单中有 select_tag,提交一个有错误的表单,立马就报错。
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.map
如果包 select_tag 换成 text_field 就没有问题。
应该是 rails 无法将错误信息的 class 加在 select_tag 的外面
<div class="field_with_errors"></div>
还是 models 验证里有其他写法???
我想知道如何解决。