aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-05-04 01:19:13 +0900
committerGitHub <noreply@github.com>2019-05-04 01:19:13 +0900
commit9b680e52f1ad4469d4fabe7f7f4e301bfe7bfd37 (patch)
tree55203921214f4f2b53eb18cae159c51ab810435c /activemodel
parent9b0e632def6a66bbd0c0aba8531b2a173f7c3064 (diff)
parent25f1e0e3ea78538fce3025dab3e5f8a48dd6fc2b (diff)
downloadrails-9b680e52f1ad4469d4fabe7f7f4e301bfe7bfd37.tar.gz
rails-9b680e52f1ad4469d4fabe7f7f4e301bfe7bfd37.tar.bz2
rails-9b680e52f1ad4469d4fabe7f7f4e301bfe7bfd37.zip
Merge pull request #36172 from tgxworld/recover_pluck_perf
Recover perf for `pluck` by reverting 9c9c950d02af83742a5f76302d0faa9…
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)