aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-09-03 21:30:54 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-09-03 21:30:54 +0000
commit3f14b1e94ea7ed8c33cf2efa3220a3931b16b189 (patch)
tree218612161532b2041aeb3f54aa3aae98459786d4 /actionpack/lib/action_view
parent9fdd453257c3a257ad614dfe640b516c9495c503 (diff)
downloadrails-3f14b1e94ea7ed8c33cf2efa3220a3931b16b189.tar.gz
rails-3f14b1e94ea7ed8c33cf2efa3220a3931b16b189.tar.bz2
rails-3f14b1e94ea7ed8c33cf2efa3220a3931b16b189.zip
Updated the options_for_select to deal with the fact that Strings now implement :first
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2126 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/form_options_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb
index b17f4284b0..1daa5782de 100644
--- a/actionpack/lib/action_view/helpers/form_options_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -109,7 +109,7 @@ module ActionView
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