title: Devise Logging User out on AJAX request. Rails 3.1
body: <p>I have a controller which uses AJAX for CRUD, however whenever I click on one of my remote links (Delete for example) I see the rails server has decided to log me out and redirect me. Inspection of the server logs state that it cannot verify CSRF Authenticity. How do I include the CSRF token in my request?</p>
  
  <p>Running:
  - Rails 3.1
  - Devise 1.4.4
  - jquery-rails 1.0.13</p>
  
  <p>Relevant Controller Action:</p>
  
  <pre><code> def destroy
       @article = Article.find(params[:id])
        if @article.destroy
          flash[:notice] = "Article deleted."
          respond_to do |format|
          format.html{redirect_to articles_path}
          format.js{}
        end
        else
          flash[:error] = "Try Again."
          redirect_to :back
        end
  </code></pre>
  
  <p>Layouts/application.html.erb</p>
  
  <pre><code>      &lt;head&gt;
      &lt;title&gt;&lt;%= content_for?(:title) ? yield(:title) : "Untitled" %&gt;&lt;/title&gt;
  &lt;link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap-1.1.1.min.css&gt;
      &lt;%= stylesheet_link_tag "application" %&gt;
      &lt;%= javascript_include_tag :defaults %&gt;
     &lt;script type="text/javascript"&gt;jQuery.ajaxSetup({ beforeSend: function (xhr) { xhr.setRequestHeader("Accept", "text/javascript"); } });&lt;/script&gt;
      &lt;%= csrf_meta_tag %&gt;
      &lt;%= yield(:head) %&gt;
    &lt;/head&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>