mirror of
https://github.com/samsonjs/grape-active_model_serializers.git
synced 2026-04-27 14:57:43 +00:00
Merge pull request #6 from tfe/master
Conform to ActiveModel::Serializers' way of determining array-ness
This commit is contained in:
commit
6700eb2cca
1 changed files with 1 additions and 1 deletions
|
|
@ -13,7 +13,7 @@ module Grape
|
||||||
@endpoint = env["api.endpoint"]
|
@endpoint = env["api.endpoint"]
|
||||||
options = endpoint.namespace_options.merge(endpoint.route_options)
|
options = endpoint.namespace_options.merge(endpoint.route_options)
|
||||||
|
|
||||||
if resource.is_a?(Array) && !resource.empty?
|
if resource.respond_to?(:to_ary) && !resource.empty?
|
||||||
# ensure we have an root to fallback on
|
# ensure we have an root to fallback on
|
||||||
endpoint.controller_name = resource.first.class.name.underscore.pluralize
|
endpoint.controller_name = resource.first.class.name.underscore.pluralize
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue