Flash :notice in redirect_to not working in some cases?

Rails3.0.3, Controller:Method update:

  1. Redirect to Show, flash is shown, works
    format.html {
    redirect_to(@article, :notice => ‘Article was successfully
    saved.’)
    }

2- Redirect to Edit, flash is shown, works
format.html {
flash[:notice] = ‘Article was successfully saved.’
redirect_to(:action => ‘edit’)
}

  1. Redirect to Edit, flash is NOT shown
    format.html {
    redirect_to(:action => ‘edit’, :notice => ‘Article was
    successfully saved.’)
    }

The flash is in application.html.erb:

    <section id="flash">
        <% flash.each do |key, value| %>
            <div class="flash <%= key %>"><%= value %></div>
          <% end %>
    </section>

    <%= yield %>
</section>

Can someone explain this behaviour to me?

On Jan 8, 12:56pm, bourne [email protected] wrote:

 flash[:notice] = 'Article was successfully saved.'
 redirect_to(:action => 'edit')
}
  1. Redirect to Edit, flash is NOT shown
    format.html {
    redirect_to(:action => ‘edit’, :notice => ‘Article was
    successfully saved.’)
    }

Can someone explain this behaviour to me?

In the third case, rails thinks that :notice is part of the routing
options - you can probably see that the url redirected to has ?
notice=… on it. Ruby can’t know that the first bit is for the
routing options has and that the second bit is for the other options
hash. On the other hand, in the first case it is unambiguous

Fred