Sha256: 06252756c24cace3c69ccf2d6a2e50b45ebd656c65f80e849893fcb4c8df0c54

Contents?: true

Size: 819 Bytes

Versions: 4

Compression:

Stored size: 819 Bytes

Contents

require "rails/railtie"
require "roar/rails/url_methods"

module Roar
  module Rails
    class Railtie < ::Rails::Railtie
      config.representer = ActiveSupport::OrderedOptions.new

      rescue_responses = config.action_dispatch.rescue_responses || ActionDispatch::ShowExceptions.rescue_responses #newer or fallback to 3.0
      rescue_responses.merge!(
          'Roar::Rails::ControllerAdditions::UnsupportedMediaType' => :unsupported_media_type
      )

      initializer "roar.set_configs" do |app|
        ::Roar::Representer.module_eval do
          include app.routes.url_helpers
          include app.routes.mounted_helpers unless (::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 0)

          include UrlMethods  # provide an initial #default_url_options.
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/roar-rails-1.2.0/lib/roar/rails/railtie.rb
roar-rails-1.2.0 lib/roar/rails/railtie.rb
roar-rails-1.1.0 lib/roar/rails/railtie.rb
roar-rails-1.0.2 lib/roar/rails/railtie.rb