Search code examples
ruby-on-railsransack

Rails Ransack include blank in multiple select


I'm using the gem Ransack in a Rails 3.2 app.

The following works to select multiple values:

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

But, is there a way to include a blank?

I've tried these:

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

Thanks for the help!!


Solution

  • OK - this worked:

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