OakCH / scheduler

Vacation Scheduler for the Oakland Children's Hospital
7 stars 10 forks source link

Flash[:error] isn't displaying for AdminController#upload #44

Closed helenaut closed 12 years ago

helenaut commented 12 years ago

I think it's because at the beginning of upload, you initialize flash[:error] to an empty array. Basically, you are:

  1. setting flash[:error] to an empty array
  2. adding error messages to flash[:error]
  3. redirecting
  4. 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.