aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_options_helper.rb
diff options
context:
space:
mode:
authorBrian Rose <brian@heimidal.net>2011-12-20 13:19:55 -0700
committerJosé Valim <jose.valim@gmail.com>2011-12-20 22:51:14 +0100
commit55334f52d49630bf73ce06e4f4ec4682a7fe566a (patch)
tree8fec5f0c83588532cf7ef5834a49a79063837fe1 /actionpack/lib/action_view/helpers/form_options_helper.rb
parent0d7ca947272e4eff0c0447c5760d1b53167b685b (diff)
downloadrails-55334f52d49630bf73ce06e4f4ec4682a7fe566a.tar.gz
rails-55334f52d49630bf73ce06e4f4ec4682a7fe566a.tar.bz2
rails-55334f52d49630bf73ce06e4f4ec4682a7fe566a.zip
Ensure option for select helper responds to `#first` before comparison.
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_options_helper.rb')
-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 f895cad058..a8690430e5 100644
--- a/actionpack/lib/action_view/helpers/form_options_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -584,7 +584,7 @@ module ActionView
# [nil, []]
# { nil => [] }
#
- if !choices.empty? && Array === choices.first.last
+ if !choices.empty? && choices.first.respond_to?(:first) && 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])