problems getting flash to display

I have a controller that looks exactly like the code below. My problem is that I can't get the flash[:notice]'s to show up on the page. Interestingly though, I when I test this controller, I have tests that make it go down both of the unhappy paths (the ActiveRecord::RecordInvalid exception and 'some_boolean_expression should've been true') and these tests pass when 'assert_match' on the flash...

assert_match(/Error saving:/, flash[:notice])

and

assert_match(/some_boolean_expression should've been true/, flash[:notice])

respectively

Any thoughts on what could possibly explain the fact I can't see the flash in the browser?

TIA...

===== controller code =====

  def do_the_action
    if (some_boolean_expression)
      begin
        model = ModelObject.new(:attribute1 => "1", :attribute2 => "2")
        model.save!
                path = "a/path" redirect_to(path) rescue ActiveRecord::RecordInvalid => error
        # findme: this flash notice doesn't seem to be showing up; logging it for now
        @@log.error("Error saving: #{error}")
        flash[:notice] = "Error saving: #{error}"
        redirect_to :action => "show"
      end
    else
      # findme: this flash notice doesn't seem to be showing up; logging it for now
      @@log.error("some_boolean_expression should've been true")
      flash[:notice] = "some_boolean_expression should've been true"
      redirect_to :action => "show"
    end
  end

Like you say, my view template has '<%= flash[:notice] %>' in it. I'm using hobo's dryml though instead of rhtml, so that may be contributing to the problem. I'll check over on their list.

Thanks...

Matthew Rudy wrote:

Hopefully this will help someone else. The problem was that the first line of the 'show' action that the 'do_the_action' action was redirecting to did this:

flash[:notice] = nil

It threw me off since the flash was being picked up in the test.

Bryan Noll wrote: