Fixed ActionView::FormOptionsHelper#select with :multiple => false #1927

merged 1 commit into from Jul 1, 2011


None yet
2 participants

bogdan commented Jul 1, 2011

The following code:

select :post, :category_ids, [], {}, :multiple => false

Generates the select with name post[category_id][]. This is kinda confusing to add [] in case of false and nil for multiple attribute.

In real example with conditional multiple key we need the following:

select ..., {:class => "gg").merge(my_condition ? {:multiple => true}, {})

That is not very natural. So fixed default name to add [] only when :multiple looks truly.

josevalim added a commit that referenced this pull request Jul 1, 2011

Merge pull request #1927 from bogdan/select_multiple_index
Fixed ActionView::FormOptionsHelper#select with :multiple => false

@josevalim josevalim merged commit b31ce90 into rails:master Jul 1, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment