Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update dummy rails app

  • Loading branch information...
commit 7f75f62e80497a9c0db65c24fed9ba9d0c8dd372 1 parent 1737a7c
@mjankowski mjankowski authored
View
10 spec/dummy/config/database.yml
@@ -1,5 +1,5 @@
# SQLite version 3.x
-# gem install sqlite3-ruby (not necessary on OS X Leopard)
+# gem install sqlite3
development:
adapter: sqlite3
database: db/development.sqlite3
@@ -12,6 +12,12 @@ sqlite3-ruby: &sqlite3-ruby
pool: 5
timeout: 5000
+sqlite3: &sqlite3
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000
+
mysql: &mysql
adapter: mysql
database: pacecar_test
@@ -36,7 +42,7 @@ pg: &pg
# This is because of appraisal - find the gem which was loaded, and use that driver
test:
- <<: *<%= Gem.loaded_specs.keys.select { |key| ['sqlite3-ruby', 'mysql', 'mysql2', 'pg'].include? key }.first %>
+ <<: *<%= Gem.loaded_specs.keys.select { |key| ['sqlite3-ruby', 'sqlite3', 'mysql', 'mysql2', 'pg'].include? key }.first %>
production:
adapter: sqlite3
View
16 spec/dummy/public/javascripts/rails.js
@@ -172,4 +172,20 @@
input.disabled = false;
});
});
+
+ Ajax.Responders.register({
+ onCreate: function(request) {
+ var csrf_meta_tag = $$('meta[name=csrf-token]')[0];
+
+ if (csrf_meta_tag) {
+ var header = 'X-CSRF-Token',
+ token = csrf_meta_tag.readAttribute('content');
+
+ if (!request.options.requestHeaders) {
+ request.options.requestHeaders = {};
+ }
+ request.options.requestHeaders[header] = token;
+ }
+ }
+ });
})();
Please sign in to comment.
Something went wrong with that request. Please try again.