From 25f1e0e3ea78538fce3025dab3e5f8a48dd6fc2b Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Fri, 3 May 2019 22:24:52 +0800 Subject: [PATCH] Recover perf for `pluck` by reverting 9c9c950d02af83742a5f76302d0faa99508f242c. This reverts commit 9c9c950d02af83742a5f76302d0faa99508f242c. --- activemodel/lib/active_model/type/integer.rb | 5 +++++ 1 file changed, 5 insertions(+) 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)