From b8e8096a89b0405544c8004c9c445a7894cf7ec9 Mon Sep 17 00:00:00 2001 From: Gustavo Beathyate Date: Tue, 15 Jul 2014 15:50:29 -0500 Subject: Implement required #encode_with While running the spec `ARCONN=mysql2 ruby -v -Itest test/cases/yaml_serialization_test.rb` the following warning shows up: `implementing to_yaml is deprecated, please implement "encode_with"` --- activerecord/lib/active_record/relation/delegation.rb | 4 ++++ activerecord/test/cases/yaml_serialization_test.rb | 1 + 2 files changed, 5 insertions(+) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb index 50f4d5c7ab..df3ac43b0a 100644 --- a/activerecord/lib/active_record/relation/delegation.rb +++ b/activerecord/lib/active_record/relation/delegation.rb @@ -119,6 +119,10 @@ module ActiveRecord arel.respond_to?(method, include_private) end + def encode_with(coder) + coder.represent_seq(nil, to_a) + end + protected def array_delegable?(method) diff --git a/activerecord/test/cases/yaml_serialization_test.rb b/activerecord/test/cases/yaml_serialization_test.rb index 9f1d110ddb..bce59b4fcd 100644 --- a/activerecord/test/cases/yaml_serialization_test.rb +++ b/activerecord/test/cases/yaml_serialization_test.rb @@ -1,5 +1,6 @@ require 'cases/helper' require 'models/topic' +require 'models/reply' require 'models/post' require 'models/author' -- cgit v1.2.3