This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VerifyCachedFileValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
if carrierwave_file_lost?(value.cache_dir, value.cache_name) | |
record.send("remove_#{attribute}!") | |
record.errors[attribute] << "We encountered an error when trying to upload your #{attribute}. Please select it again." | |
end | |
end | |
private |