Hi, I'm trying to include the support of Msgpack<https://github.com/msgpack/msgpack-ruby> in Rails 3.2 but 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 module MPAC extend ActiveSupport::Concern include ActiveModel::Serialization included do extend ActiveModel::Naming end def to_mpac(options = nil) serializable_hash(options).to_msgpack end alias_method :to_msgpack, :to_mpac def from_mpac(msg) MessagePack.unpack(msg) end end end end Anyone has an idea ? Thanks.
on 2013-02-01 09:20
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.