Skip to content

Instantly share code, notes, and snippets.

@znz
Created February 9, 2011 00:45
Show Gist options
  • Save znz/817638 to your computer and use it in GitHub Desktop.
Save znz/817638 to your computer and use it in GitHub Desktop.
rails 3.0.3 と 3.0.4 で new した直後の diff
diff -urN v303/.gitignore v304/.gitignore
--- v303/.gitignore 2011-02-09 08:02:18.576247002 +0900
+++ v304/.gitignore 2011-02-09 08:07:41.568247001 +0900
@@ -1,4 +1,4 @@
.bundle
db/*.sqlite3
log/*.log
-tmp/**/*
+tmp/
diff -urN v303/Gemfile v304/Gemfile
--- v303/Gemfile 2011-02-09 08:02:18.576247002 +0900
+++ v304/Gemfile 2011-02-09 08:07:41.568247002 +0900
@@ -1,11 +1,11 @@
source 'http://rubygems.org'
-gem 'rails', '3.0.3'
+gem 'rails', '3.0.4'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
-gem 'sqlite3-ruby', :require => 'sqlite3'
+gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
diff -urN v303/config/boot.rb v304/config/boot.rb
--- v303/config/boot.rb 2011-02-09 08:02:18.716247001 +0900
+++ v304/config/boot.rb 2011-02-09 08:07:41.588247002 +0900
@@ -1,13 +1,6 @@
require 'rubygems'
# Set up gems listed in the Gemfile.
-gemfile = File.expand_path('../../Gemfile', __FILE__)
-begin
- ENV['BUNDLE_GEMFILE'] = gemfile
- require 'bundler'
- Bundler.setup
-rescue Bundler::GemNotFound => e
- STDERR.puts e.message
- STDERR.puts "Try running `bundle install`."
- exit!
-end if File.exist?(gemfile)
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
diff -urN v303/config/database.yml v304/config/database.yml
--- v303/config/database.yml 2011-02-09 08:02:18.720247001 +0900
+++ v304/config/database.yml 2011-02-09 08:07:41.588247002 +0900
@@ -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
diff -urN v303/public/javascripts/rails.js v304/public/javascripts/rails.js
--- v303/public/javascripts/rails.js 2011-02-09 08:02:18.832247000 +0900
+++ v304/public/javascripts/rails.js 2011-02-09 08:07:41.604247002 +0900
@@ -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;
+ }
+ }
+ });
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment