Flash notices are not accessible on next request

For some reason, which I cannot detect, no flash notices that I set
prior to redirects are available after the redirect.

This standard "forgot password" action as an example:

def forgot
    if request.post?
      user = User.find_by_email(params[:user][:email])
      if user
        flash[:notice] = "A reset email was sent to #{user.email}"
         flash[:notice] = "The email #{params[:user][:email]} does not
exist in system"
         redirect_to forgot_path

If I enter a bad email address, the forgot action/view should redisplay
with the flash message. Up until a little while ago, it did. Something
changed, but I am not sure what it is. Flash messages that are set
before renders do display (my layouts contain the display of the flash
message, so are available on most every page).

Using the debugger, I have verified that just after the flash[:notice]
statement, the flash hash is set correctly. But when processing returns
to the forgot method after the redirect, the flash hash is empty. So it
seems that the message is not making to the session, or is not being
restored from the session.

Sessions are working properly otherwise.

Any thoughts would be greatly appreciated.

7stud -- wrote:

Is there a second redirect in your code somewhere?

That is a good thought. I was thinking along the same lines, so checked
the console after issuing a request that should end with a displayed
flash message and saw that there was only a single redirect. I also
tried adding "keep" to the flash set statement, but alas, no message

I am really stumped on this one.

Luke Pearce wrote:

I had the same issue - it was because of the render_component plugin.
Take that out and everything worked properly.

However this might be something worth looking at too:

Luke - Thanks for responding. I use embedded Active Scaffolds, so need
to have render component installed. I commented out a line that called

     def assign_shortcuts_with_render_component(request, response)
        assign_shortcuts_without_render_component(request, response)
        #flash.sweep if @_session && !component_request?

which seems to make things work without breaking others, but I can't be
too sure. I sent a message to the author of render_component and have
not heard whether this is a bad thing to do.