mirror of
https://github.com/samsonjs/grape-active_model_serializers.git
synced 2026-04-27 14:57:43 +00:00
Merge pull request #24 from sonxurxo/master
Makes it possible to use current_user within serializers
This commit is contained in:
commit
85b92a4856
1 changed files with 1 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ module Grape
|
||||||
options = build_options_from_endpoint(endpoint)
|
options = build_options_from_endpoint(endpoint)
|
||||||
|
|
||||||
if serializer = options.fetch(:serializer, ActiveModel::Serializer.serializer_for(resource))
|
if serializer = options.fetch(:serializer, ActiveModel::Serializer.serializer_for(resource))
|
||||||
options[:scope] = endpoint.serialization_scope unless options.has_key?(:scope)
|
options[:scope] = endpoint unless options.has_key?(:scope)
|
||||||
# ensure we have an root to fallback on
|
# ensure we have an root to fallback on
|
||||||
options[:resource_name] = default_root(endpoint) if resource.respond_to?(:to_ary)
|
options[:resource_name] = default_root(endpoint) if resource.respond_to?(:to_ary)
|
||||||
serializer.new(resource, options.merge(other_options))
|
serializer.new(resource, options.merge(other_options))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue