From: Tom Hughes Date: Tue, 15 Mar 2011 18:47:48 +0000 (+0000) Subject: Update to rails 3.0.5, arel 2.0.9 and composite_primary_keys 3.1.4 X-Git-Tag: live~6640 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/6d59a122ead9e2cc7d340ba6ec13cfdc250e1e5e?hp=604011d6a88571730f2fbb0c4b718f5edccafc30 Update to rails 3.0.5, arel 2.0.9 and composite_primary_keys 3.1.4 --- diff --git a/Gemfile b/Gemfile index 88f2ff11a..015b4fcdc 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,9 @@ source 'http://rubygems.org' -gem 'rails', '3.0.4' +gem 'rails', '3.0.5' gem 'pg' -gem 'arel', '>= 2.0.8' +gem 'arel', '>= 2.0.9' gem 'libxml-ruby', '>= 2.0.5', :require => 'libxml' gem 'rmagick', :require => 'RMagick' gem 'oauth', '>= 0.4.4' @@ -18,7 +18,7 @@ gem 'validates_email_format_of', '>= 1.4.5' gem 'memcached' # Should only load if we're not in database offline mode -gem 'composite_primary_keys', '>= 3.1.1' +gem 'composite_primary_keys', '>= 3.1.4' # Bundle gems for the local environment. Make sure to # put test-only gems in this group so their generators diff --git a/config/boot.rb b/config/boot.rb index ab6cb374d..4489e5868 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -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 --git a/config/environments/development.rb b/config/environments/development.rb index 3b0aeb6ea..49d237870 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,5 +1,5 @@ OpenStreetMap::Application.configure do - # Settings specified here will take precedence over those in config/environment.rb + # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development diff --git a/config/environments/production.rb b/config/environments/production.rb index d99d3369c..d33ada540 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,5 +1,5 @@ OpenStreetMap::Application.configure do - # Settings specified here will take precedence over those in config/environment.rb + # Settings specified here will take precedence over those in config/application.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests diff --git a/config/environments/test.rb b/config/environments/test.rb index 41b7645cb..802a77744 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,5 +1,5 @@ OpenStreetMap::Application.configure do - # Settings specified here will take precedence over those in config/environment.rb + # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 92e415045..ffba99257 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -4,5 +4,5 @@ OpenStreetMap::Application.config.session_store :cookie_store, :key => '_osm_ses # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information -# (create the session table with "rake db:sessions:create") +# (create the session table with "rails generate session_migration") # OpenStreetMap::Application.config.session_store :active_record_store diff --git a/public/javascripts/rails.js b/public/javascripts/rails.js index 4283ed898..aed6aed36 100644 --- a/public/javascripts/rails.js +++ b/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; + } + } + }); })();