Skip to content

Commit 81a13c4

Browse files
authored
Merge pull request #2093 from bf4/undef_unneeded_kernel_methods
Undef problematic Object methods
2 parents 7d0f4e0 + 4fb635b commit 81a13c4

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/active_model/serializer.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
# reified when subclassed to decorate a resource.
1313
module ActiveModel
1414
class Serializer
15+
undef_method :select, :display # These IO methods, which are mixed into Kernel,
16+
# sometimes conflict with attribute names. We don't need these IO methods.
17+
1518
# @see #serializable_hash for more details on these valid keys.
1619
SERIALIZABLE_HASH_VALID_KEYS = [:only, :except, :methods, :include, :root].freeze
1720
extend ActiveSupport::Autoload

lib/active_model_serializers/model.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# ActiveModelSerializers::Model is a convenient superclass for making your models
22
# from Plain-Old Ruby Objects (PORO). It also serves as a reference implementation
33
# that satisfies ActiveModel::Serializer::Lint::Tests.
4+
require 'active_support/core_ext/hash'
45
module ActiveModelSerializers
56
class Model
67
include ActiveModel::Serializers::JSON

0 commit comments

Comments
 (0)