mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-23 14:27:52 +00:00
dont rely on add_error return value to exit. sigh, less one liners
This commit is contained in:
parent
88ee33ae41
commit
3348ca3063
@ -38,8 +38,15 @@ module ValidatesTimeliness
|
||||
|
||||
return if (raw_value.nil? && configuration[:allow_nil]) || (raw_value.blank? && configuration[:allow_blank])
|
||||
|
||||
add_error(record, attr_name, :blank) and return if raw_value.blank?
|
||||
add_error(record, attr_name, "invalid_#{type}".to_sym) and return if value.nil?
|
||||
if raw_value.blank?
|
||||
add_error(record, attr_name, :blank)
|
||||
return
|
||||
end
|
||||
|
||||
if value.nil?
|
||||
add_error(record, attr_name, "invalid_#{type}".to_sym)
|
||||
return
|
||||
end
|
||||
|
||||
validate_restrictions(record, attr_name, value)
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user