Module: Grape::Helpers::ActiveModelSerializers
- Defined in:
- lib/grape/helpers/active_model_serializers.rb
Instance Method Summary collapse
-
#render(resource, active_model_serializer_options = {}) ⇒ Object
A convenience method for passing ActiveModelSerializers serializer options.
Instance Method Details
#render(resource, active_model_serializer_options = {}) ⇒ Object
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 })
13 14 15 16 |
# File 'lib/grape/helpers/active_model_serializers.rb', line 13 def render(resource, = {}) env[:active_model_serializer_options] = resource end |