flash[:notice] is meant only for redirect
action, because the message is only cleared after at the end of
redirected view request. So if you don’t redirect the request, and you
click on the next request, that message will still be displayed.
But sometimes, we just want to display custom error messages only for current request without the redirection (esp. for non-ActiveRecord error messages). So the option is to use flash.now[:notice]. It clears the flash message at the end of current request (without redirection)
But sometimes, we just want to display custom error messages only for current request without the redirection (esp. for non-ActiveRecord error messages). So the option is to use flash.now[:notice]. It clears the flash message at the end of current request (without redirection)