mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-28 21:43:42 +01:00
fix integer cast bug
Gotta love Rails.
This commit is contained in:
parent
77491a8f22
commit
17d23d1c73
1 changed files with 2 additions and 0 deletions
|
@ -173,6 +173,8 @@ class UserSettingsDecorator
|
||||||
|
|
||||||
def integer_cast_setting(key, min = nil, max = nil)
|
def integer_cast_setting(key, min = nil, max = nil)
|
||||||
i = ActiveModel::Type::Integer.new.cast(settings[key])
|
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 min if !min.nil? && i < min
|
||||||
return max if !max.nil? && i > max
|
return max if !max.nil? && i > max
|
||||||
i
|
i
|
||||||
|
|
Loading…
Reference in a new issue