Sha256: 33805d9f75d13758c44074efc1041d3297f823c8e1d3579346ac650ead62803d
Contents?: true
Size: 668 Bytes
Versions: 1
Compression:
Stored size: 668 Bytes
Contents
# A Grape response formatter that can be used as 'formatter :json, Grape::Formatters::ActiveModelSerializers' # # Serializer options can be passed as a hash from your Grape endpoint using env[:active_model_serializer_options], # or better yet user the render helper in Grape::Helpers::ActiveModelSerializers module Grape module Formatters module ActiveModelSerializers def self.call(resource, env) serializer_options = {} serializer_options.merge!(env[:active_model_serializer_options]) if env[:active_model_serializer_options] ActiveModel::SerializableResource.new(resource, serializer_options).to_json end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_model_serializers-0.10.0.rc4 | lib/grape/formatters/active_model_serializers.rb |