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 %>