fix integer cast bug

Gotta love Rails.
This commit is contained in:
fef 2022-12-02 10:17:59 +00:00
parent 77491a8f22
commit 17d23d1c73
No known key found for this signature in database
GPG key ID: EC22E476DC2D3D84

View file

@ -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