Skip to content

Commit 3ba4a8c

Browse files
committed
Always return an enumerator
1 parent 3fb72d9 commit 3ba4a8c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/active_model/serializer.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,9 @@ def attributes(requested_attrs = nil, reload = false)
332332
# @param [JSONAPI::IncludeDirective] include_directive (defaults to the
333333
# +default_include_directive+ config value when not provided)
334334
# @return [Enumerator<Association>]
335-
#
336335
def associations(include_directive = ActiveModelSerializers.default_include_directive, include_slice = nil)
337336
include_slice ||= include_directive
338-
return unless object
337+
return Enumerator.new unless object
339338

340339
Enumerator.new do |y|
341340
self.class._reflections.values.each do |reflection|

0 commit comments

Comments
 (0)