Skip to content

Instantly share code, notes, and snippets.

@djo
Created May 15, 2014 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djo/c8a6ca3ff5661d226276 to your computer and use it in GitHub Desktop.
Save djo/c8a6ca3ff5661d226276 to your computer and use it in GitHub Desktop.
Setup Syck YAML engine in Ruby 2, Rails, DelayedJob
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
# YAML Syck engine support was dropped in Ruby 2.0 and it's available only by a gem 'syck'.
# Some gems (delayed_job[1] for instance) have YAML extensions depending on the engine.
# Switching to the Syck engine should be done in boot.rb before loading all gems in application.rb:
require 'yaml'
require 'syck'
YAML::ENGINE.yamler = 'syck'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment