Skip to content

Commit 208eba3

Browse files
authored
Replace respond_to?(:each) with respond_to?(:to_ary) for collection check. (#12)
1 parent 8fa349b commit 208eba3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/jsonapi/renderer/document.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def data_hash
3838
primary, included =
3939
ResourcesProcessor.new(Array(@data), @include, @fields).process
4040
{}.tap do |hash|
41-
hash[:data] = @data.respond_to?(:each) ? primary : primary[0]
41+
hash[:data] = @data.respond_to?(:to_ary) ? primary : primary[0]
4242
hash[:included] = included if included.any?
4343
end
4444
end

0 commit comments

Comments
 (0)