Sha256: 83204cc551b2dd74fc98ed222b89294114a5e9a6309f78db61a35fa35df3181f

Contents?: true

Size: 672 Bytes

Versions: 3

Compression:

Stored size: 672 Bytes

Contents

# Helpers can be included in your Grape endpoint as: helpers Grape::Helpers::ActiveModelSerializers
module Grape
  module Helpers
    module ActiveModelSerializers
      # A convenience method for passing ActiveModelSerializers serializer options
      #
      # Example: To include relationships in the response: render(post, include: ['comments'])
      #
      # Example: To include pagination meta data: render(posts, meta: { page: posts.page, total_pages: posts.total_pages })
      def render(resource, active_model_serializer_options = {})
        env[:active_model_serializer_options] = active_model_serializer_options
        resource
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_model_serializers-0.10.0 lib/grape/helpers/active_model_serializers.rb
active_model_serializers-0.10.0.rc5 lib/grape/helpers/active_model_serializers.rb
active_model_serializers-0.10.0.rc4 lib/grape/helpers/active_model_serializers.rb