validates_timeliness
validates_timeliness copied to clipboard
raise errors in validation procs instead of swallowing them
As we have been discussing in a patch comment thread, the least surprise would be for the validations to raise errors as the occur, not swallow them. I think this will give us that without breaking existing systems.
Thanks! Looks good, though I had in mind to merge the ignore/raise/error into a single config setting. Then override the old setting accordingly.
Something like this
e if ValidatesTimeliness.validation_errors == :raise
if ValidatesTimeliness.validation_errors == :message
or heaven forbid a case statement
case ValidatesTimeliness.validation_errors
when :raise
raise e
when :message
add_error(record, message)
when :log
Rails.logger.warn('validation error')
else # :ignore
end
thoughts?
I got no complaints :)