Sha256: 943d706a95edcc85ab2a561fa3c4702d1f5f1c4394ac43a57af7c053330132f1

Contents?: true

Size: 673 Bytes

Versions: 11

Compression:

Stored size: 673 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

11 entries across 11 versions & 2 rubygems

Version Path
active_model_serializers-0.10.8 lib/grape/helpers/active_model_serializers.rb
active_model_serializers-0.10.7 lib/grape/helpers/active_model_serializers.rb
active_model_serializers-0.10.6 lib/grape/helpers/active_model_serializers.rb
active_model_serializers-0.10.5 lib/grape/helpers/active_model_serializers.rb
active_model_serializers-0.10.4 lib/grape/helpers/active_model_serializers.rb
agi_active_model_serializers-0.10.9 lib/grape/helpers/active_model_serializers.rb
agi_active_model_serializers-0.10.8 lib/grape/helpers/active_model_serializers.rb
agi_active_model_serializers-0.10.7 lib/grape/helpers/active_model_serializers.rb
active_model_serializers-0.10.3 lib/grape/helpers/active_model_serializers.rb
active_model_serializers-0.10.2 lib/grape/helpers/active_model_serializers.rb
active_model_serializers-0.10.1 lib/grape/helpers/active_model_serializers.rb