Quantcast
Viewing all articles
Browse latest Browse all 25

The Flash showing up erratically and one behind posted by Bill Gathen @ Thu, 11 Feb 2010 11:46:54 +0000

I’ve got a quiz app where the update action redirects back to the edit action if not all questions are correct. If they are correct, it displays the update view.

There are 2 failure states:
  • Not all questions are populated (they’re radio buttons)
  • All are populated, but not all are correct

When update finds a failure, it stores the prompt in flash[:error] and the edit view uses facebook_messages to display it.

The trouble is, over half the time nothing appears, though the edit page is re-displayed correctly. When I supply correct answers, it displays the update view correctly.

When it does show the message, it’s always one submission behind: if I submit no questions and get nothing, the next time I might supply all questions but none are right and instead of getting “0 of 2 are correct” I get “You can’t win if you don’t supply all the answers!”

I added a before_filter to echo the flash to the logs if it exists, and I only see results in the logs when I see results on the page, so it only keeps the flash some of the time. When it does, sometimes I see it in the logs for the update hit AND for the edit hit on the redirect, sometimes just on the edit hit. When it doesn’t, I don’t see it either place.

I know the flash is only available on the next request, but the response shows “200 OK” every time (success and failure), so could this have something to do with the facebook redirect logic?

I’m using facebooker 1.0.59 and rails 2.2.2. The behavior is the same in development on my local machine and in production on heroku.

Thanks,
Bill


Viewing all articles
Browse latest Browse all 25

Trending Articles