我知道您可以通过此问题中发布的方法覆盖ActionView::Base
:
Rails 3: "field-with-errors" wrapper changes the page appearance. How to avoid this?
但是,我想知道如何在每个视图的基础上禁用它?换句话说,除了我指定的视图外,我希望默认行为是站点范围。
答案 0 :(得分:0)
你可以在视图中做到这一点
<% unless @user.errors["email"].blank? &>
@user.errors["email"] = "your custom message"
<% end %>