Flash now on failure #26

Closed
wants to merge 3 commits into
from

Projects

None yet

4 participants

@iain

Since the usual pattern is that a page gets rerendered after failure, the proper behavior would be to set the flash directly, so that it doesn't stick around if you give up and leave the page.

This is a redone version of my last pull request, with some improvements.

iain added some commits Jul 9, 2011
@iain iain Set default of flash_now to :on_failure
Since the usual pattern is that a page gets rerendered after failure,
the proper behavior would be to set the flash directly, so that it
doesn't stick around if you give up and leave the page.
b706e7e
@iain iain Use a default for flash_now, enabling it to be set to false.
The previous behavior to never set flash.now can now be used again.
d36fc1a
@iain iain assert_not_flash_now should require that the flash is set
Otherwise it would return a false positive when the flash wasn't set at
all.
e98dd3c
@nadnerb

Seems to do the trick, merge please.

@did

I assume there has to be a reason why flash_now is not set by default to :on_failure. Am I right people from plataformatec ?

In my app, I write a custom responder and I re-define the set_flash_now? method within it like that:

    def set_flash_now?
      super || has_errors?
    end
@josevalim
Plataformatec member

This pull request was good. Could you please rebase? I know I am late to the party, but for some reason it seems I was not receiving notifications. :(

@iain iain referenced this pull request Mar 6, 2012
Merged

Flash now on failure (rebase) #37

@josevalim josevalim closed this Mar 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment