monterail/guidelines — pull request #177 by chytreg (2013-08-21 10:36:59+00:00)
Title: Setup XSRF-TOKEN cookie in Rails for angular CSRF protection

Imho cleaner and more solid solution than set X-CSRF-Token on Angular site ([source](http://stackoverflow.com/questions/14734243/rails-csrf-protection-angular-js-protect-from-forgery-makes-me-to-log-out-on)).

Had some problems with token setting when I run test on poltergeist or capybara-webkit.
If you want to use client side more solid solution is to use:

```coffeescript
# Inject CSRF Token
angular.element(document).ready () =>
@app.config ["$httpProvider", (provider) ->
provider.defaults.headers.common['X-CSRF-Token'] = angular.element('meta[name="csrf-token"]').attr('content')
]
```
or the cookie solution which I prefer.