aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-04-29 11:57:09 -0700
committerJosé Valim <jose.valim@gmail.com>2012-04-29 11:57:09 -0700
commitd99affed2f7400f6b39e7b373507e76df34783e3 (patch)
tree7155a06bb9e4dce3fe512df6b63eca974e0b55e1 /actionpack/lib
parentcca536122d55c4253e0c820d961c800b5a19258f (diff)
parenta872ac9d6f7ed441507bf2a60fac44399c8abea6 (diff)
downloadrails-d99affed2f7400f6b39e7b373507e76df34783e3.tar.gz
rails-d99affed2f7400f6b39e7b373507e76df34783e3.tar.bz2
rails-d99affed2f7400f6b39e7b373507e76df34783e3.zip
Merge pull request #6059 from rafaelfranca/check_box_inverted
Change check_box to work inverting the checked and unchecked value
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/tags/check_box.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/tags/check_box.rb b/actionpack/lib/action_view/helpers/tags/check_box.rb
index 1a4aebb936..9d17a1dde3 100644
--- a/actionpack/lib/action_view/helpers/tags/check_box.rb
+++ b/actionpack/lib/action_view/helpers/tags/check_box.rb
@@ -41,17 +41,15 @@ module ActionView
def checked?(value)
case value
when TrueClass, FalseClass
- value
+ value == !!@checked_value
when NilClass
false
- when Integer
- value != 0
when String
value == @checked_value
when Array
value.include?(@checked_value)
else
- value.to_i != 0
+ value.to_i == @checked_value.to_i
end
end