page doesn't display flash[:notice] after redirect from rjs

I register a user in with an Ajax request

after saving a user, and setting the flash[:notice] = "welcome message", I perform the rendering

         format.js {            render :update do |page|              page << "window.parent.Shadowbox.close();"              #page.reload (?)              page.redirect_to root_url)            end          }

in my home page view, I have :

<div id="content"> <% if flash[:notice] %><div class="notice" id="flash"><%= flash [:notice] %></div><% end %>

but when displayed the notice doesn't appear ...

I need to perform manually a page reload in the Firefox browser to see the notice displayed...

iI tried to insert a page.reload in the js rendering but it does not solve the problem...

what are you advices ?

thanks

Use flash.now instead of plain flash when you do the assignment.

------ from the API docs now() Sets a flash that will not be available to the next action, only to the current.

    flash.now[:message] = "Hello current action" This method enables you to use the flash as a central messaging system in your app. When you need to pass an object to the next action, you use the standard flash assign (=). When you need to pass an object to the current action, you use now, and your object will vanish when the current action is done.

Thanks for your help I did it, it doesn't solve this issue the notice is actually correctly set but the browser needs a manual refresh to display it

a very small issue but taking me hours to solve ...

found a solution.... but I have to understand why it runs...

the issue was not the display of the flash notice in the home page, but the redirection to the home page from within the rjs file in my rjs file I need to write   page << "window.parent.Shadowbox.close();"   page << "window.parent.document.location.href = '#{root_url}'"

this close the Shadowbox window and redirect to the home page I cannot use the standard    page.redirect_to root_url

I beive it's related to the Shadowbox displayed within an iframe....