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.

--------

On Jun 29, 3:18 pm, Erwin <[email protected]> wrote:
> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to