Sha256: ef04489067a427f11ad09cd2e71345f0bdf869d773bea36935020f0c67ae63a5
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require "active_support" require "msgpack_rails/version" require "msgpack_rails/activesupport/message_pack" module ActiveSupport eager_autoload do autoload :MessagePack end end if defined?(ActiveModel) require "msgpack_rails/activemodel/serializers/message_pack" module ActiveModel module Serializers eager_autoload do autoload :MessagePack end end end end if defined?(::Rails) module MsgpackRails class Rails < ::Rails::Engine initializer "msgpack_rails" do if defined?(::ActiveRecord::Base) ::ActiveSupport.on_load(:active_record) do ::ActiveRecord::Base.send(:include, ActiveModel::Serializers::MessagePack) end end if defined?(::Mongoid::Document) ::ActiveSupport.on_load(:mongoid) do ::Mongoid::Document.send(:include, ActiveModel::Serializers::MessagePack) end end ::Mime::Type.register "application/msgpack", :msgpack ::ActionController.add_renderer :msgpack do |data, options| self.content_type = Mime::MSGPACK self.response_body = data.as_msgpack(options) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
msgpack_rails-0.4.0 | lib/msgpack_rails.rb |