File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ def self.serializer_lookup_chain_for(klass)
202
202
def self . get_serializer_for ( klass )
203
203
serializers_cache . fetch_or_store ( klass ) do
204
204
# NOTE(beauby): When we drop 1.9.3 support we can lazify the map for perfs.
205
- serializer_class = serializer_lookup_chain_for ( klass ) . map ( &:safe_constantize ) . find { |x | x }
205
+ serializer_class = serializer_lookup_chain_for ( klass ) . map ( &:safe_constantize ) . find { |x | x && x < ActiveModel :: Serializer }
206
206
207
207
if serializer_class
208
208
serializer_class
Original file line number Diff line number Diff line change @@ -44,11 +44,20 @@ class CustomProfile
44
44
def serializer_class ; ProfileSerializer ; end
45
45
end
46
46
47
+ Tweet = Class . new ( ::Model )
48
+ TweetSerializer = Class . new
49
+
47
50
def setup
48
51
@profile = Profile . new
49
52
@my_profile = MyProfile . new
50
53
@custom_profile = CustomProfile . new
51
54
@model = ::Model . new
55
+ @tweet = Tweet . new
56
+ end
57
+
58
+ def test_serializer_for_non_ams_serializer
59
+ serializer = ActiveModel ::Serializer . serializer_for ( @tweet )
60
+ assert_nil ( serializer )
52
61
end
53
62
54
63
def test_serializer_for_existing_serializer
You can’t perform that action at this time.
0 commit comments