如何使用简单形式输出字段的完整错误消息?相当于rails:%= RESOURCE.errors.full_messages% 例如显示这个: "Email has already been taken", "Password confirmation doesn't match Password", "Password is too short
例如显示这个:
"Email has already been taken", "Password confirmation doesn't match Password", "Password is too short (minimum is 8 characters)"
而不是:f.error_notification
"has already been taken", "doesn't match Password", "is too short (minimum is 8 characters)"
simple_form(3.0.2)/ Rails 4.1.1
如果有人仍然想知道现在有一种简单的方法可以做到这一点,参考 here只需在config / initializers / simple_form.rb下,将b.user:error更改为b.user:full_error,现在您的错误消息将等同于RESOURCE.errors.full_messages
注意:如果您使用的是带简单表单的bootstrap,则更改simple_form_bootstrap.rb