# why did I have to monkeypatch this? :P class Time def to_msgpack(*args) self.to_i.to_msgpack(*args) end end class UsersController < ApplicationController respond_to :json, :msgpack, :protobuf, :marshall def index respond_to do |fmt| fmt.json do render json: users end fmt.msgpack do send_data MessagePack.pack(users.as_json) end fmt.protobuf do d = Userland::Users.new d.user = users.map(&:to_pb) send_data d.serialize_to_string end end end private def users [User.all, User.all, User.all, User.all].flatten end end