Fix migration for ruby 1.9. Move YAML check into application.rb, and add guard for ruby 1.8.x.

This commit is contained in:
Sarah Mei 2011-06-04 20:12:34 -07:00
parent f0eeb17562
commit ba9df59977
3 changed files with 10 additions and 8 deletions

View file

@ -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.

View file

@ -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'
end if File.exist?(gemfile)

View file

@ -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