1.7.17. 错误丢弃 (向上)
当表单因为无效数据而无法提交时,错误
数组将位于相关模型中。
1.7.17.1. 方法
1.7.17.1.1. attribute
模型的返回属性到这个错误是相关的
{{ account.errors.org_name.first.attribute }} <!-- org_name -->
1.7.17.1.2. message
返回错误描述
{{ account.errors.first.message }} <!-- cannot be blank -->
1.7.17.1.3. value
返回与 错误
相关的属性值
{{ account.errors.org_name.first.value }} <!-- => "ACME Co." -->
1.7.17.1.4. to_str
返回错误的完整描述(包括属性名称)
{{ model.errors.first }} <!-- => "Attribute can't be blank" -->