2011-11-26 44 views

回答

1

如果你在頁的開頭使用傳統的「errorExplanation」 DIV,你可以使用這樣的事情:

<% @some_entity.errors.full_messages.each do |msg| %> 
    <li><%= msg.html_safe %></li> 
<% end %> 

在其他情況下,如果你使用ActionView::Base.field_error_proc,你可以過去html_safe在該代碼的適當位置。

0

嘗試:message => "<b>City</b> is required item!".html_safe

+0

是的,我已經試過這個,但是在瀏覽器中只會顯示標籤,文本將不會加粗。 – user984621