lib/generators/templates/store.js.em in ember-rails-0.15.0 vs lib/generators/templates/store.js.em in ember-rails-0.15.1
- old
+ new
@@ -1,5 +1,12 @@
-class <%= application_name.camelize %>.Store extends DS.Store
-
# Override the default adapter with the `DS.ActiveModelAdapter` which
# is built to work nicely with the ActiveModel::Serializers gem.
class <%= application_name.camelize %>.ApplicationAdapter extends DS.ActiveModelAdapter
+
+# Adds X-CSRF-Token to all REST requests.
+# Allows for the use of Rails protect_from_forgery
+# The CSRF Token is normally found in app/views/layouts/application.html.*
+# inserted with the rails helper: "csrf_meta_tags"
+DS.RESTAdapter.reopen(
+ headers:
+ "X-CSRF-Token": $('meta[name="csrf-token"]').attr('content')
+)