From 3ee6bcfc3d3e7be0dd3b76ac929500aaf031f8f9 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Sat, 20 Oct 2012 22:27:43 +0300 Subject: check_box value can be not only an object of Array class there is a chance that `value` is a Set or an object that reponses to `include?` method so let's handle this case --- actionpack/lib/action_view/helpers/tags/check_box.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/tags/check_box.rb b/actionpack/lib/action_view/helpers/tags/check_box.rb index 9d17a1dde3..e21cc07746 100644 --- a/actionpack/lib/action_view/helpers/tags/check_box.rb +++ b/actionpack/lib/action_view/helpers/tags/check_box.rb @@ -46,10 +46,12 @@ module ActionView false when String value == @checked_value - when Array - value.include?(@checked_value) else - value.to_i == @checked_value.to_i + if value.respond_to?(:include?) + value.include?(@checked_value) + else + value.to_i == @checked_value.to_i + end end end -- cgit v1.2.3