Why is the first element always blank in my Rails multi-select, using an embedded array?

In Rails 4:

You will be able to pass :include_hidden option. https://github.com/rails/rails/pull/5414/files

As a quick fix for now: you can use right now in your model:

before_validation do |model|
  model.subset_array.reject!(&:blank?) if model.subset_array

This will just delete all blank values at model level.

Leave a Comment