Simplified range check

This commit is contained in:
jaideng123 2014-08-26 14:04:28 -05:00
parent f53001577e
commit 1de67281f4

View file

@ -1,11 +1,6 @@
SimpleCaptcha.setup do |sc|
sc.image_size = AppConfig.settings.captcha.image_size
value_length = AppConfig.settings.captcha.captcha_length.to_i
if value_length <= 12 && value_length > 0
sc.length = value_length
else
sc.length = 5
end
sc.length = [1, [AppConfig.settings.captcha_length.to_i, 12].min].max
sc.image_style = AppConfig.settings.captcha.image_style
sc.distortion = AppConfig.settings.captcha.distortion
p AppConfig.settings.captcha