title: How to generate <%= csrf_meta_tags %> in public/index.html file
body: <p>I use Backbone on frontend, and Ruby on Rails on backend. I have devise gem, for my authentication. A couple of days before, frontend team, finished their part of work, and now I need to bind this all together. So I try to send data with json trough backbone (standard way) with request <code>Started POST "/users/sign_in.json"</code>, and I get an error <code>Completed 401 Unauthorized in 180ms</code> even if I put <code>protect_from_forgery except: :create</code> in my custom sessions controller. Like this:</p>
  
  <pre><code>class UserSessions::SessionsController &lt; Devise::SessionsController
  
      protect_from_forgery except: :create
      ......
  end
  </code></pre>
  
  <p>How to omit this, or where i must generate my <code>&lt;%= csrf_meta_tags %&gt;</code> so I can use this approach which I found on web:</p>
  
  <pre><code>App.csrfToken = $("meta[name='csrf-token']").attr('content');
  
  Backbone.sync = (function(original) {
    return function(method, model, options) {
      options.beforeSend = function(xhr) {
        xhr.setRequestHeader('X-CSRF-Token', App.csrfToken);
      };
      original(method, model, options);
    };
  })(Backbone.sync);
  </code></pre>
  
  <p>I can't move this back to standard rails assets pipeline, because the frontend was written separately from my backend, which is depended on require.js.</p>