From 17d23d1c7360ce4d50d53fd107d429657e2b4350 Mon Sep 17 00:00:00 2001 From: fef Date: Fri, 2 Dec 2022 10:17:59 +0000 Subject: [PATCH] fix integer cast bug Gotta love Rails. --- app/lib/user_settings_decorator.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb index f4360b9475..92c393785b 100644 --- a/app/lib/user_settings_decorator.rb +++ b/app/lib/user_settings_decorator.rb @@ -173,6 +173,8 @@ class UserSettingsDecorator def integer_cast_setting(key, min = nil, max = nil) i = ActiveModel::Type::Integer.new.cast(settings[key]) + # the cast above doesn't return a number if passed the string "e" + i = 0 unless i.is_a? Numeric return min if !min.nil? && i < min return max if !max.nil? && i > max i