Skip to content

Commit 43c3c23

Browse files
committed
Use reflection key since we have it
1 parent 3ba4a8c commit 43c3c23

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
@@ -337,9 +337,8 @@ def associations(include_directive = ActiveModelSerializers.default_include_dire
337337
return Enumerator.new unless object
338338

339339
Enumerator.new do |y|
340-
self.class._reflections.values.each do |reflection|
340+
self.class._reflections.each do |key, reflection|
341341
next if reflection.excluded?(self)
342-
key = reflection.options.fetch(:key, reflection.name)
343342
next unless include_directive.key?(key)
344343

345344
y.yield reflection.build_association(self, instance_options, include_slice)

0 commit comments

Comments
 (0)