title: flash message not displaying after redirect or render
body: <p>Using rails 4 and ruby 2</p>
  
  <p>Having trouble displaying the flash messages from my controllers. My method looks like this:</p>
  
  <pre><code>def create
      @salary_report = SalaryReport.create(salary_report_params)
      if @salary_report.save  
        redirect_to @salary_report
        flash[:notice] = "Lönerapporten sparades korrekt!"
        puts "salary report saved #{flash[:notice]}"
      else
        render :new, notice: "Något gick fel när lönerapporten skulle sparas!"      
      end
    end
  </code></pre>
  
  <p>As you can see, I have added a puts statement printing out the flash notice just to prove that the flash notice is getting generated after the redirect.</p>
  
  <p>The logs look like this after creating a salary report:</p>
  
  <pre><code>Redirected to http://localhost:3000/salary_reports/20
  salary report saved Lönerapporten sparades korrekt!
  Completed 302 Found in 25ms (ActiveRecord: 9.7ms)
  </code></pre>
  
  <p>After getting to show view logs:</p>
  
  <pre><code>Started GET "/salary_reports/22" for 127.0.0.1 at 2013-07-24 16:08:42 +0200
  Processing by SalaryReportController#show as HTML
    Parameters: {"id"=&gt;"22"}
    SalaryReport Load (0.5ms)  SELECT "salary_reports".* FROM "salary_reports" WHERE         "salary_reports"."id" = ? LIMIT 1  [["id", "22"]]
    Document Lo ad (0.3ms)  SELECT "documents".* FROM "documents" WHERE          "documents"."salary_report_id" = ?  [["salary_report_id", 22]]
    Rendered salary_report/show.html.erb within layouts/application (6.1ms)
    User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 3 ORDER BY     "users"."id" ASC LIMIT 1
  Completed 200 OK in 62ms (Views: 58.0ms | ActiveRecord: 1.1ms)
  </code></pre>
  
  <p>In the view, I show the messages with this:</p>
  
  <pre><code>&lt;% flash.each do |name, msg| %&gt;
        &lt;% if msg.is_a?(String) %&gt;
          &lt;div class="alert alert-&lt;%= name == :notice ? "success" : "error" %&gt;"&gt;
            &lt;a class="close" data-dismiss="alert"&gt;&amp;#215;&lt;/a&gt;
            &lt;%= content_tag :div, msg, :id =&gt; "flash_#{name}" %&gt;
          &lt;/div&gt;
        &lt;% end %&gt;
      &lt;% end %&gt;
  </code></pre>
  
  <p>I have tried a variety of different ways to write the controller method but nothing seems to help. Very uncertain about what the problem could be.</p>