title: How does "respond_with_navigational" work?
body: <p>I'm working with Devise and DeviseInvitable to manage authentication in my app and I'm having some trouble adding AJAX support to InvitationsController#update. The controller in DeviseInvitable looks like this:</p>
  
  <pre><code># invitations_controller.rb
  
  # PUT /resource/invitation                                                                                                 
  def update
    self.resource = resource_class.accept_invitation!(params[resource_name])
  
    if resource.errors.empty?
      set_flash_message :notice, :updated
      sign_in(resource_name, resource)
      respond_with resource, :location =&gt; after_accept_path_for(resource)
    else
      respond_with_navigational(resource){ render_with_scope :edit }
    end
  end
  </code></pre>
  
  <p>This works well when <code>resource.errors.empty? == true</code> and we execute:</p>
  
  <pre><code>respond_with resource, :location =&gt; after_accept_path_for(resource)
  </code></pre>
  
  <p>(i.e. invitations/update.js.erb is rendered and my javascript calls are made). The problem is that when <code>resource.errors.empty? == false</code>, and we execute:</p>
  
  <pre><code>respond_with_navigational(resource){ render_with_scope :edit }
  </code></pre>
  
  <p>the server says:</p>
  
  <pre><code>Rendered invitations/update.js.erb (1.4ms)
  </code></pre>
  
  <p>but my javascript calls are not being run. Can anyone explain what <code>respond_with_navigational</code> is supposed to be doing? I've been googling for hours and I haven't found an explanation of this api anywhere.</p>
  
  <p>Thanks!</p>