From ba9df5997792149435df2f0fd029becd7ba73d0f Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Sat, 4 Jun 2011 20:12:34 -0700 Subject: [PATCH] Fix migration for ruby 1.9. Move YAML check into application.rb, and add guard for ruby 1.8.x. --- config/application.rb | 8 ++++++++ config/boot.rb | 8 +------- db/migrate/20110603233202_drop_aspects_open.rb | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/config/application.rb b/config/application.rb index 87f80a1a2..e3c13ad26 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,6 +4,14 @@ require File.expand_path('../boot', __FILE__) +# Needed for versions of ruby 1.9.2 that were compiled with libyaml. +# They use psych by default which doesn't handle having a default set of parameters. +# See bug #1120. +require 'yaml' +if RUBY_VERSION.include? '1.9' + YAML::ENGINE.yamler= 'syck' +end + require 'rails/all' # If you have a Gemfile, require the gems listed there, including any gems # you've limited to :test, :development, or :production. diff --git a/config/boot.rb b/config/boot.rb index 4d7174977..fe6375db2 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -14,10 +14,4 @@ rescue Bundler::GemNotFound => e STDERR.puts e.message STDERR.puts "Try running `bundle install`." exit! -end if File.exist?(gemfile) - -# Use older yaml parser to fix issues with -# db:create and db:migrate failing with empty database -# See bug #1120 -require 'yaml' -YAML::ENGINE.yamler= 'syck' \ No newline at end of file +end if File.exist?(gemfile) \ No newline at end of file diff --git a/db/migrate/20110603233202_drop_aspects_open.rb b/db/migrate/20110603233202_drop_aspects_open.rb index 7cef9e57e..6bf015561 100644 --- a/db/migrate/20110603233202_drop_aspects_open.rb +++ b/db/migrate/20110603233202_drop_aspects_open.rb @@ -1,5 +1,5 @@ class DropAspectsOpen < ActiveRecord::Migration - require 'db/migrate/20110202015222_add_open_to_aspects' + require File.join(Rails.root, "db", "migrate", "20110202015222_add_open_to_aspects") def self.up AddOpenToAspects.down end