mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Bug fix for ArraySerializer json_key
When the resource is a zero result query,
i.e. post_comments = PostComment.where("1=0")
the json_key will become 'postcomments' rather than 'post_comments'.
Using 'underscore' instead of 'downcase' fixes the error.
This commit is contained in:
parent
954e4c51fe
commit
7faa5e8e2e
@ -29,7 +29,7 @@ module ActiveModel
|
|||||||
if @objects.first
|
if @objects.first
|
||||||
@objects.first.json_key.pluralize
|
@objects.first.json_key.pluralize
|
||||||
else
|
else
|
||||||
@resource.name.downcase.pluralize if @resource.try(:name)
|
@resource.name.underscore.pluralize if @resource.try(:name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user