I have an Image uploading application running on carrierwave which restrict user from uploading image only of desired extensions 'jpg,jpeg,png' I have put in place the validation for carrierwave in my Uploader define as
def extension_white_list
%w(jpg jpeg png)
end
Now anyone trying to upload image having extension different from the desired extension(mention above) will result in validation errors
I want to customize the Validation Error message
Right Now Error message is presented as
You are not allowed to upload "" files, allowed types: ["jpg","jpeg","png"]
Can anyone help I found this link where the guys mention how to achieve this
but it some problem
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
Please Provide me answer in term of CarrierWave and please dont ask me to write separate validation set for extension matching
Actually it is:
en:
errors:
messages:
extension_white_list_error: "You are not allowed to upload %{extension} files, allowed types: %{allowed_types}"
Source:
https://github.com/jnicklas/carrierwave/blob/master/lib/carrierwave/locale/en.yml