title: rails flash.now from partial
body: <p>I have a controller that is supposed to display a flash message. The flash message is not displaying.
  My only problem is the flash messages not showing up. If anyone could please give an explanation for this that would be awesome. I am guessing that my error is noobish but i do not know enough to explain what is happening.</p>
  
  <p>Edit: I added my Log for this section</p>
  
  <p>Edit: When i click the manage button with invalid information nothing happens. When i refresh the page the flash message shows up. I really just need the current page refreshed but it is not working. If anyone has any ideas please share them.</p>
  
  <p>Edit: I have tried changing things to
  <code>redirect_to @department, :notice =&gt; "invalid Password"</code></p>
  
  <p>I am still not able to get the flash message to show up. </p>
  
  <p>EDIT: From <a href="http://ionrails.com/2009/09/19/flashnotice-vs-flash-nownotice/" rel="nofollow">this</a> site it says flash now will be displayed in the view that you are rendering. But my rendered view is a partial. Can anyone at least let me know if i am on the right track. A little direction or thought other than my own?</p>
  
  <p>This is the create method for my relationship.</p>
  
  <pre><code>def create
      @department = Department.find(params[:manager_relationship][:department_id])
      if @department.authenticate(params[:manager_relationship][:password])
      current_user.manage!(@department)
      respond_to do |format|
          format.html { redirect_to @department }
          format.js
          end
      else
          redirect_to department_path@department, :alert =&gt; "Invalid Password"
      end
  end
  </code></pre>
  
  <p>This same code is used successfully in my sessions controller.</p>
  
  <pre><code>SessionsController
  if user &amp;&amp; user.authenticate(params[:session][:password])
          sign_in user
          redirect_back_or user
      else
          flash.now[:error] = 'Invalid email/password combination'
          render 'new'
      end
  </code></pre>
  
  <p>It is called from a partial</p>
  
  <p>department/show.hmtl.erb</p>
  
  <pre><code>&lt;% provide(:title, @department.department_name) %&gt;
  &lt;div class="span8"&gt;
      &lt;%= render 'manage_form' if signed_in? %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>_manage_form.html.erb</p>
  
  <pre><code>&lt;div id="manage_form"&gt;
  &lt;% if current_user.managing?(@department) %&gt;
  &lt;%= render 'unmanage' %&gt;
  &lt;% else %&gt;
  &lt;%= render 'manage' %&gt;
  &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>_manage.html.erb</p>
  
  <pre><code>&lt;%= form_for(current_user.manager_relationships.build(department_id: @department.id), remote: true) do |f| %&gt;
  
      &lt;div&gt;
      &lt;%= f.label :password %&gt;
      &lt;%= f.password_field :password %&gt;
      &lt;/div&gt;
  
      &lt;div&gt;&lt;%= f.hidden_field :department_id %&gt;&lt;/div&gt;
      &lt;%= f.submit "Manage department", class: "btn btn-large btn-primary" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>application.html.erb</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  .
  .
  .
  ...
  &lt;body&gt;
  &lt;%= render 'layouts/header' %&gt;
  &lt;div class="container"&gt;
    &lt;% flash.each do |key, value| %&gt;
      &lt;div class="alert alert-&lt;%= key %&gt;"&gt;&lt;%= value %&gt;&lt;/div&gt;
    &lt;% end %&gt;
    &lt;%= yield %&gt;
    &lt;%= render 'layouts/footer' %&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is the log for an unmanage and manage http request</p>
  
  <pre><code>Started DELETE "/manager_relationships/22" for 127.0.0.1 at 2013-03-24 11:08:20 -0700
  Processing by ManagerRelationshipsController#destroy as JS
  Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"Y3I7qY4LBfChjdYAUlJ1eDh23YkcJRwSRfa6s2wavoI=", "commit"=&gt;"Unmanage", "id"=&gt;"22"}
  [1m[36mUser Load (0.0ms)[0m  [1mSELECT "users".* FROM "users" WHERE "users"."remember_token" = '9J1RAJy16Tooz5wMmzQohw' LIMIT 1[0m
       [1m[35mManagerRelationship Load (0.0ms)[0m  SELECT "manager_relationships".* FROM "manager_relationships" WHERE "manager_relationships"."id" = ? LIMIT 1  [["id", "22"]]
  [1m[36mDepartment Load (1.0ms)[0m  [1mSELECT "department".* FROM "departments" WHERE "department"."id" = 1 LIMIT 1[0m
  [1m[35mManagerRelationship Load (0.0ms)[0m  SELECT "manager_relationships".* FROM "manager_relationships" WHERE "manager_relationships"."user_id" = 1 AND "manager_relationships"."department_id" = 1 LIMIT 1
  [1m[36m (0.0ms)[0m  [1mbegin transaction[0m
  [1m[35mSQL (0.0ms)[0m  DELETE FROM "manager_relationships" WHERE "manager_relationships"."id" = ?      [["id", 22]]
  [1m[36m (26.0ms)[0m  [1mcommit transaction[0m
  Rendered departments/_manage.html.erb (2.0ms)
  Rendered manager_relationships/destroy.js.erb (5.0ms)
  Completed 200 OK in 86ms (Views: 11.0ms | ActiveRecord: 27.0ms)
  
  
  Started POST "/manager_relationships" for 127.0.0.1 at 2013-03-24 11:08:23 -0700
  Processing by ManagerRelationshipsController#create as JS
  Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"Y3I7qY4LBfChjdYAUlJ1eDh23YkcJRwSRfa6s2wavoI=",     "manager_relationship"=&gt;{"password"=&gt;"[FILTERED]", "department_id"=&gt;"1"}, "commit"=&gt;"Manage Bar"}
  [1m[35mUser Load (0.0ms)[0m  SELECT "users".* FROM "users" WHERE "users"."remember_token" =     '9J1RAJy16Tooz5wMmzQohw' LIMIT 1
  [1m[36mDepartment Load (0.0ms)[0m  [1mSELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1[0m      [["id", "1"]]
  Redirected to http://localhost:3000/departments/1
  Completed 406 Not Acceptable in 91ms (ActiveRecord: 0.0ms)
  </code></pre>