我有一个图像上传应用程序在carrierwave上运行,限制用户上传图片仅限期望的扩展名'jpg,jpeg,png'我已经在我的上传器中载入了carrierwave验证,定义为使用CarrierWave设置自定义错误消息
def extension_white_list
%w(jpg jpeg png)
end
现在任何人试图扩展其与期望不同的扩展名(提上)上传的图像将导致验证错误
我想自定义的验证错误消息
右ñ流错误消息是作为
You are not allowed to upload "" files, allowed types: ["jpg","jpeg","png"]
谁能帮我找到这个link其中家伙提到如何实现这一
,但它的一些问题
1. I18n support I dont require to translate the error message using I18n
2. The 'Key' to be used I not sure which key to used in YAML for
not matching extension whitelist error message (e.g) carrierwave_processing_error key if error is for processing failure
请提供我的任期回答CarrierWave和请不要求我为扩展匹配编写单独的验证集
喜@Viren我试试你的答案,但没有为我工作:(我在这里创建一个新的问题:http://stackoverflow.com/questions/19068821/custom-error-message-for -carrierwave-dont-work,有什么想法吗?我使用rails 4 – medBo 2013-09-28 16:07:50