Sha256: 071cfb00fb461fac68377c0c0bc9c7a2e0c74b85712286923945e0a6722572d6

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 Bytes

Contents

# coding: utf-8

require 'aepic'
require 'rails/engine'

module Aepic
  class Engine < Rails::Engine
    initializer 'aepic.mime_types' do
      # Unable to add Mime type synonym (only extension synonyms supported), so reregister JSON
      Mime::Type.unregister :json
      Mime::Type.register 'application/json', :json, %w( text/x-json application/jsonrequest application/vnd.api+json )
      Mime::Type.register 'application/ld+json', :jsonld

      require 'action_controller/metal/renderers'
      ActionController::Renderers.add(:jsonld) do |object, options|
        self.content_type = Mime[:jsonld]
        object.respond_to?(:jsonld) ? object.jsonld.to_json(options) : object
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aepic-0.0.4 lib/aepic/engine.rb
aepic-0.0.2 lib/aepic/engine.rb