aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-04-29 15:44:34 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-04-29 15:44:34 -0300
commita872ac9d6f7ed441507bf2a60fac44399c8abea6 (patch)
treedabbe29c2de2429018076d3cb79ae9f843ebceb2 /actionpack/lib
parent8c2cf1ad1bbb63cab4b503724465d70154f6aab0 (diff)
downloadrails-a872ac9d6f7ed441507bf2a60fac44399c8abea6.tar.gz
rails-a872ac9d6f7ed441507bf2a60fac44399c8abea6.tar.bz2
rails-a872ac9d6f7ed441507bf2a60fac44399c8abea6.zip
Change check_box to work inverting the checked and unchecked value
This fixes: * Boolean with inverted logic * Integer with inverted logic * BigDecimal with inverted logic Fixes #3995
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