aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorGuo Xiang Tan <tgx_world@hotmail.com>2019-05-03 22:24:52 +0800
committerGuo Xiang Tan <tgx_world@hotmail.com>2019-05-03 22:36:23 +0800
commit25f1e0e3ea78538fce3025dab3e5f8a48dd6fc2b (patch)
tree55203921214f4f2b53eb18cae159c51ab810435c /activemodel
parent9b0e632def6a66bbd0c0aba8531b2a173f7c3064 (diff)
downloadrails-25f1e0e3ea78538fce3025dab3e5f8a48dd6fc2b.tar.gz
rails-25f1e0e3ea78538fce3025dab3e5f8a48dd6fc2b.tar.bz2
rails-25f1e0e3ea78538fce3025dab3e5f8a48dd6fc2b.zip
Recover perf for `pluck` by reverting 9c9c950d02af83742a5f76302d0faa99508f242c.
This reverts commit 9c9c950d02af83742a5f76302d0faa99508f242c.
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/type/integer.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/type/integer.rb b/activemodel/lib/active_model/type/integer.rb
index 1e1061ff60..e9bbdf4b7b 100644
--- a/activemodel/lib/active_model/type/integer.rb
+++ b/activemodel/lib/active_model/type/integer.rb
@@ -18,6 +18,11 @@ module ActiveModel
:integer
end
+ def deserialize(value)
+ return if value.blank?
+ value.to_i
+ end
+
def serialize(value)
return if value.is_a?(::String) && non_numeric_string?(value)
ensure_in_range(super)