Rails Ransack包含多个选择中的空白

时间:2015-05-26 15:53:00

标签: ruby-on-rails ransack

我在Rails 3.2应用程序中使用gem Ransack。

以下用于选择多个值:

<td><%= f.collection_select :costproject_coststatus_id_in, Coststatus.all, :id, :statuscode, {}, { :multiple => true}

但是,有没有办法包括空白?

我试过这些:

<td><%= f.collection_select :costproject_coststatus_id_in, Coststatus.all, :id, :statuscode, {}, { :multiple => true, :include_blank => true }%></td>

<td><%= f.collection_select :costproject_coststatus_id_in, Coststatus.all, :id, :statuscode, include_blank: true, {}, { :multiple => true }%></td>

感谢您的帮助!!

1 个答案:

答案 0 :(得分:2)

好的 - 这很有效:

<td><%= f.collection_select :costproject_coststatus_id_in, Coststatus.all, :id, :statuscode, {:include_blank => true}, { :multiple => true }%></td>