From 320596b75bf616d06657a62492ee3cb1a6f80b9b Mon Sep 17 00:00:00 2001 From: Benjamin Fleischer Date: Fri, 31 Mar 2017 10:30:57 -0500 Subject: [PATCH 1/2] Undef problematic Object methods --- lib/active_model/serializer.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/active_model/serializer.rb b/lib/active_model/serializer.rb index b50cb951e..9d00e6fbf 100644 --- a/lib/active_model/serializer.rb +++ b/lib/active_model/serializer.rb @@ -12,6 +12,9 @@ # reified when subclassed to decorate a resource. module ActiveModel class Serializer + undef_method :select, :display # These IO methods, which are mixed into Kernel, + # sometimes conflict with attribute names. We don't need these IO methods. + # @see #serializable_hash for more details on these valid keys. SERIALIZABLE_HASH_VALID_KEYS = [:only, :except, :methods, :include, :root].freeze extend ActiveSupport::Autoload From 4fb635bd2925882eb9116e1e210657bb7f2912dd Mon Sep 17 00:00:00 2001 From: Benjamin Fleischer Date: Fri, 31 Mar 2017 10:42:25 -0500 Subject: [PATCH 2/2] Required --- lib/active_model_serializers/model.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/active_model_serializers/model.rb b/lib/active_model_serializers/model.rb index ea10ac881..2ff3d60c5 100644 --- a/lib/active_model_serializers/model.rb +++ b/lib/active_model_serializers/model.rb @@ -1,6 +1,7 @@ # ActiveModelSerializers::Model is a convenient superclass for making your models # from Plain-Old Ruby Objects (PORO). It also serves as a reference implementation # that satisfies ActiveModel::Serializer::Lint::Tests. +require 'active_support/core_ext/hash' module ActiveModelSerializers class Model include ActiveModel::Serializers::JSON