aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/tags/check_box.rb
diff options
context:
space:
mode:
authorVasiliy Ermolovich <younash@gmail.com>2012-10-20 22:27:43 +0300
committerVasiliy Ermolovich <younash@gmail.com>2012-10-20 22:35:31 +0300
commit3ee6bcfc3d3e7be0dd3b76ac929500aaf031f8f9 (patch)
treeb886f74b797900de63945fa74e9438c7cc323e81 /actionpack/lib/action_view/helpers/tags/check_box.rb
parentbfc6c17a87792012443e7b083e3e86810173c113 (diff)
downloadrails-3ee6bcfc3d3e7be0dd3b76ac929500aaf031f8f9.tar.gz
rails-3ee6bcfc3d3e7be0dd3b76ac929500aaf031f8f9.tar.bz2
rails-3ee6bcfc3d3e7be0dd3b76ac929500aaf031f8f9.zip
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
Diffstat (limited to 'actionpack/lib/action_view/helpers/tags/check_box.rb')
-rw-r--r--actionpack/lib/action_view/helpers/tags/check_box.rb8
1 files changed, 5 insertions, 3 deletions
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