0
我知道你可以重写通过张贴在这个问题的方法ActionView::Base
:覆盖按次基础“field_with_errors”
Rails 3: "field-with-errors" wrapper changes the page appearance. How to avoid this?
不过,我不知道如何禁用它在每个视图基础?换句话说,除了我指定的视图之外,我想要广泛的默认行为。
我知道你可以重写通过张贴在这个问题的方法ActionView::Base
:覆盖按次基础“field_with_errors”
Rails 3: "field-with-errors" wrapper changes the page appearance. How to avoid this?
不过,我不知道如何禁用它在每个视图基础?换句话说,除了我指定的视图之外,我想要广泛的默认行为。
你可以做的是,在视图本身
<% unless @user.errors["email"].blank? &>
@user.errors["email"] = "your custom message"
<% end %>