Hi,
I''d be very grateful if some sage person can offer me any words
of wisdom on this.
I have an app, say a shop. The shop displays the a summary in the
cart in the side bar, the layout for the shop looks like...
<html>
<head>
<title>Pragprog Books Online Store</title>
<%= stylesheet_link_tag "depot", :media => "all" %>
</head>
<body>
<div id="banner">
<img src="/images/logo.png"/>
<%= @page_title || "Pragmatic Bookshelf" %>
</div>
<div id="columns">
<div id="side">
<a href="http://www....">Home</a><br />
<a href="http://www..../faq">Questions</a><br />
<a href="http://www..../news">News</a><br />
<a href="http://www..../contact">Contact</a><br />
<%= render_component(:controller => ''store'', :action
=>
''cart_summary'') %>
</div>
<div id="main">
<% if @flash[:notice] -%>
<div id="notice"><%= @flash[:notice] %></div>
<% end -%>
<%= @content_for_layout %>
</div>
</div>
</body>
</html>
All taken straight from the PragProg book with the addition that I''m
displaying a mini-cart in the sidebar through the render_component
call. This action just gets the cart and displays a mini-list.
My problem is this: as you can see, the flash gets displayed after
render_components. In this case the flash is "Your cart is empty",
"invalid product" etc.
However, the flash isn''t displayed. If the code to display the flash
is places above the render_component it works find, if it''s placed
after it then it doesn''t so I presume the that act of rendering a
component ''eats'' the flash and I''d like to know the
''correct'' to
avoid this. Currently I''m just calling flash.keep in the action
cart_summary.
Did any of that make sense?
Ta,
Gav