如果存在的形式(主要来自外部API)语义错误,我想添加的说明信息,像这样:添加消息formtastic语义错误块
<%= semantic_form_for @order, :url => checkout_purchase_url, :html => {:class => 'payment'}, :wrapper_html => { :class => "field" } do |f| %>
<% if f.has_errors? %>
<p>There were errors that prevented your order from being submitted. If you need assistance, please contact us toll-free at <strong>1-800-555-5555</strong>.</p>
<%= f.semantic_errors %>
<% end %>
<% end %>
然而,has_errors?
是一个受保护方法。有没有办法可以做到这一点?谢谢。