Sha256: f01551008933f6b7493a72deeba635c147b7238918519f6f022a8a4fa972194d

Contents?: true

Size: 587 Bytes

Versions: 5

Compression:

Stored size: 587 Bytes

Contents

module MyApi
  class Railtie < Rails::Railtie

    config.action_dispatch.rescue_responses.merge!(
      'MyApi::RecordInvalid'  => :unprocessable_entity, # 422
      'MyApi::RecordNotFound' => :not_found, # 404
    )

    initializer "my_api.cache_store" do |app|
      MyApi::Api.cache_store = Rails.cache
    end

    initializer "my_api.log_runtime" do |app|
      require 'my_api/rails/log_subscriber'
      ActiveSupport.on_load(:action_controller) do
        include NCore::ControllerRuntime
        register_api_runtime MyApi::LogSubscriber, 'MyApi'
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ncore-3.5.1 example/lib/my_api/rails/railtie.rb
ncore-3.5.0 example/lib/my_api/rails/railtie.rb
ncore-3.4.4 example/lib/my_api/rails/railtie.rb
ncore-3.4.3 example/lib/my_api/rails/railtie.rb
ncore-3.4.2 example/lib/my_api/rails/railtie.rb