{"issue":{"created_at":"2011-11-30T03:49:11Z","state":"open","updated_at":"2011-11-30T03:49:11Z","comments":0,"user":{"gravatar_id":"25e782eb7e799e78d781b0026fc6a4d8","id":12844,"url":"https://api.github.com/users/masterkain","login":"masterkain","avatar_url":"https://secure.gravatar.com/avatar/25e782eb7e799e78d781b0026fc6a4d8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"Hello,\r\nI followed the instruction of the wiki in order to add MessagePack support.\r\n\r\nFirst I had to add the corresponding entry in initializers/mime_types.rb, something that's not written on the wiki, this is the code:\r\n\r\n    Mime::Type.register \"application/messagepack\", :mpac\r\n\r\nThen in controller I have this (Rails 3.2, git master, relevant bits):\r\n\r\n    class InternalsController < ApplicationController\r\n      self.responder = ActsAsApi::Responder\r\n      respond_to :json, :xml, :mpac\r\n\r\n      def user_info\r\n        respond_with(@owner, api_template: :v2_private)\r\n      end\r\n\r\nThe problem is that Rails is trying to render a messagepack view.\r\n\r\n# config/initializers/acts_as_api.rb\r\n\r\n    # Tell acts_as_api that it should accept an additional API format.\r\n    ActsAsApi::Config.accepted_api_formats << :mpac\r\n\r\n    # Add MessagePack as a Rails renderer.\r\n    ActionController::Renderers.add :mpac do |object, options|\r\n      self.content_type ||= Mime::MPAC\r\n      self.response_body = MessagePack.pack(object)\r\n    end\r\n\r\n    # MessagePack doesn't come with the ability to serialize a TimeWithZone, monkey patch.\r\n    module ActiveSupport\r\n      class TimeWithZone\r\n        def to_msgpack(out = '')\r\n          self.to_s.to_msgpack(out)\r\n        end\r\n      end\r\n    end\r\n\r\nRSpec tests fails:\r\n\r\n    Failure/Error: get 'user_info', format: 'mpac', k: string\r\n    ActionView::MissingTemplate:\r\n     Missing template internals/user_info, application/user_info with {:locale=>[:en, :en], :formats=>[:mpac], :handlers=>[:erb, :builder, :coffee, :haml]}. Searched in:\r\n       * \"#<RSpec::Rails::ViewRendering::EmptyTemplatePathSetDecorator:0x007fcbe04a7f28>\"\r\n\r\nAm I missing something? Thanks!","assignee":null,"id":2397161,"number":46,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[],"title":"Issue with rendering MessagePack","html_url":"https://github.com/fabrik42/acts_as_api/issues/46","closed_at":null,"url":"https://api.github.com/repos/fabrik42/acts_as_api/issues/46","milestone":null},"action":"opened"}