Permalink
Browse files

scumbag 1.8: strings are enumerable :'(

  • Loading branch information...
1 parent 0d0176c commit 902764379838d0d2b98e262c4039b7069cada3f8 @tenderlove tenderlove committed Oct 26, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -584,7 +584,7 @@ def to_select_tag(choices, options, html_options)
# [nil, []]
# { nil => [] }
#
- if !choices.empty? && choices.first.last.respond_to?(:each)
+ if !choices.empty? && Array === choices.first.last
option_tags = grouped_options_for_select(choices, :selected => selected_value, :disabled => options[:disabled])
else
option_tags = options_for_select(choices, :selected => selected_value, :disabled => options[:disabled])

1 comment on commit 9027643

Contributor

alindeman commented on 9027643 Oct 26, 2011

How about keeping the duck typing, but simply blacklist String instances? respond_to?(:each) && !is_a?(String) kinda thing.

Please sign in to comment.