Skip to content

Commit

Permalink
Updated the options_for_select to deal with the fact that Strings now…
Browse files Browse the repository at this point in the history
… implement :first

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2126 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Sep 3, 2005
1 parent 9fdd453 commit 3f14b1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/helpers/form_options_helper.rb
Expand Up @@ -109,7 +109,7 @@ def options_for_select(container, selected = nil)
container = container.to_a if Hash === container

options_for_select = container.inject([]) do |options, element|
if element.respond_to?(:first) && element.respond_to?(:last)
if element.is_a?(Array) || element.is_a?(Range)
is_selected = ( (selected.respond_to?(:include?) ? selected.include?(element.last) : element.last == selected) )
is_selected = ( (selected.respond_to?(:include?) && !selected.is_a?(String) ? selected.include?(element.last) : element.last == selected) )
if is_selected
Expand Down

0 comments on commit 3f14b1e

Please sign in to comment.