Displaying 1 result from an estimated 1 matches for "to_msgpack".
2013 Feb 01
0
Add a customer renderer but I get missing template
...when I try to return a mpac response, I get an error
concerning a missing template.
My renderer:
Mime::Type.register ''application/x-mpac'', :mpac
ActionController::Renderers.add :mpac do |mpac, options|
self.content_type ||= Mime::MPAC
self.response_body = mpac.respond_to?(:to_msgpack) ? mpac.to_msgpack : mpac
end
My controller:
class UsersController < ApplicationController
respond_to :mpac, :json
def show
respond_with({ hello: ''world'' })
end
end
And my serializer:
require ''msgpack''
module ActiveModel
module Serializers...