Search code examples
ruby-on-railsruby-on-rails-3internet-explorerflash-message

Flash messages showing up inconsistently in IE


I have a weird problem with flash messages not showing up in IE (tried 8 and 9):

  • it always works with other browser
  • the problem is only on one page (this page renders different forms based on a parameter)
  • the flash message always appears on development, but only sometimes on staging and prod
  • I see the flash message being logged in all cases, [notice] Your changes have been saved. Next step..., even when it doesn't appear on the page!
  • The error flash message always shows up, it's the notice that doesn't work properly.

Here's my update action:

def update 
  @form = Forms::Events::EditForm.build_for(@event, params[:event])
  if @form.save
    redirect_to edit_challenge_path(@form.event, form: @form.event_name), notice: "Your changes have been saved. #{@form.next_form}".html_safe
  else
    flash.now[:alert] = "Please correct the errors highlighted below."
    render "groups/events/edit"
  end
end

Any ideas on what could be wrong?


Solution

  • Agreeing with @AnthonyAlberto's comment. What you want is the .now method of flash, e.g. flash.now[:alert] = ... Here's a good explanation of the difference.