aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew White <andrew.white@unboxed.co>2016-11-03 15:11:05 +0000
committerAndrew White <andrew.white@unboxed.co>2016-11-03 15:11:05 +0000
commit707f59042a58d329f8237ba5af1af8bca51e2266 (patch)
treebb11ac4d27e9e09387921cccbd1e25b49bd3d87c
parent7cef8061ab98261887001f8c6fba3f52a85dbaa8 (diff)
downloadrails-707f59042a58d329f8237ba5af1af8bca51e2266.tar.gz
rails-707f59042a58d329f8237ba5af1af8bca51e2266.tar.bz2
rails-707f59042a58d329f8237ba5af1af8bca51e2266.zip
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.
-rw-r--r--activerecord/lib/active_record/base.rb4
1 files 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 = {}