I think it's because at the beginning of upload, you initialize flash[:error] to an empty array. Basically, you are:
setting flash[:error] to an empty array
adding error messages to flash[:error]
redirecting
setting flash[:error] to an empty array upon redirect
so the flash[:error] is always an empty array.
a fix I did was getting rid of flash[:error] = [] and instead checking to see if flash[:error] existed every time you added an error message. I think this method isn't very DRY so you're probably better off thinking of another solution.
I think it's because at the beginning of upload, you initialize flash[:error] to an empty array. Basically, you are:
so the flash[:error] is always an empty array.
a fix I did was getting rid of flash[:error] = [] and instead checking to see if flash[:error] existed every time you added an error message. I think this method isn't very DRY so you're probably better off thinking of another solution.