diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-11-29 05:20:10 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-11-29 05:20:10 -0800 |
commit | 4aa8d3443156856fe0ee0ccb02e6a7256d0ead8c (patch) | |
tree | 188fb211f4492bca356ff61bdc9a387c6d0f719c /activerecord | |
parent | b782731ce345d94d0929f284ea0c025005798380 (diff) | |
parent | 33b69c4f4cd9fd14fc84b2e807b14bb8bce4ebc1 (diff) | |
download | rails-4aa8d3443156856fe0ee0ccb02e6a7256d0ead8c.tar.gz rails-4aa8d3443156856fe0ee0ccb02e6a7256d0ead8c.tar.bz2 rails-4aa8d3443156856fe0ee0ccb02e6a7256d0ead8c.zip |
Merge pull request #13100 from akshay-vishnoi/f-refactor
#type_cast - improve performance & readability
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 3d3c3ee79b..f97823d1a4 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -207,9 +207,14 @@ module ActiveRecord end def type_cast(value, column) - return super unless value == true || value == false - - value ? 1 : 0 + case value + when TrueClass + 1 + when FalseClass + 0 + else + super + end end # MySQL 4 technically support transaction isolation, but it is affected by a bug |