From 707f59042a58d329f8237ba5af1af8bca51e2266 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 3 Nov 2016 15:11:05 +0000 Subject: Tweak conditionals on YAML handling There's no YAML::ENGINE constant in Ruby 1.8 and Ruby 2.2+ but the former still needs to use the deprecated Syck behavior. --- activerecord/lib/active_record/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 181c072211..77ad428685 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -648,10 +648,10 @@ module ActiveRecord #:nodoc: "#<#{self.class} #{inspection}>" end - if YAML.const_defined?(:ENGINE) + if RUBY_VERSION < '2.2' # Hackery to accomodate Syck. Remove for 4.0. def to_yaml(opts = {}) #:nodoc: - if !YAML::ENGINE.syck? + if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck? super else coder = {} -- cgit v1.2.3