【发布时间】:2011-10-06 08:38:49
【问题描述】:
我试过:include_blank => true,但没用。
<select>
<%= options_for_select Model.all.collect{|mt| [mt.name, mt.id]} %>
</select>
如果我需要将它添加到集合中,你会怎么做?
【问题讨论】:
-
我相信 Rails 2 和 3 是一样的?您可能想要使用 collection_select 帮助程序而不是 html 选择标记 - 有关 include_blank 的更多信息 - house9.blogspot.com/2009/04/…
标签: ruby-on-rails ruby-on-rails-3 erb html-select