Merge pull request #24 from sonxurxo/master

Makes it possible to use current_user within serializers
This commit is contained in:
jrhe 2014-10-06 13:01:09 +01:00
commit 85b92a4856

View file

@ -17,7 +17,7 @@ module Grape
options = build_options_from_endpoint(endpoint)
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
options[:resource_name] = default_root(endpoint) if resource.respond_to?(:to_ary)
serializer.new(resource, options.merge(other_options))