Sha256: c48ea741351050c826488751ac4db8083be8a868350ef2984997867b237e555b

Contents?: true

Size: 706 Bytes

Versions: 9

Compression:

Stored size: 706 Bytes

Contents

require 'active_support/concern'
require 'responders'
require 'roar-rails'

module HalApi::Controller
  extend ActiveSupport::Concern

  require 'hal_api/controller/actions'
  require 'hal_api/controller/cache'
  require 'hal_api/controller/resources'
  require 'hal_api/controller/exceptions'

  include HalApi::Controller::Actions
  include HalApi::Controller::Cache
  include HalApi::Controller::Resources
  include HalApi::Controller::Exceptions

  included do
    include Roar::Rails::ControllerAdditions

    before_action :set_accepts
    respond_to :hal, :json

    hal_rescue_standard_errors
  end

  private

  def set_accepts
    request.format = :json if request.format == Mime::HTML
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hal_api-rails-0.3.7 lib/hal_api/controller.rb
hal_api-rails-0.3.6 lib/hal_api/controller.rb
hal_api-rails-0.3.5 lib/hal_api/controller.rb
hal_api-rails-0.3.4 lib/hal_api/controller.rb
hal_api-rails-0.3.3 lib/hal_api/controller.rb
hal_api-rails-0.3.2 lib/hal_api/controller.rb
hal_api-rails-0.3.1 lib/hal_api/controller.rb
hal_api-rails-0.3.0 lib/hal_api/controller.rb
hal_api-rails-0.2.9 lib/hal_api/controller.rb