Sha256: f61f4d57f7828f4c163ce23016e918381a34d06f104dd77cc96086a2f17dbc0e

Contents?: true

Size: 514 Bytes

Versions: 1

Compression:

Stored size: 514 Bytes

Contents

module Raisin
  module ApiFormat
    def formats
      @env["action_dispatch.request.formats"] ||= 
        if @env.key?('raisin.format')
          Array(Mime::Type.lookup(@env['raisin.format']))
        elsif parameters[:format]
          Array(Mime[parameters[:format]])
        elsif use_accept_header && valid_accept_header
          accepts
        elsif xhr?
          [Mime::JS]
        else
          [Mime::HTML]
        end
    end    
  end
end

ActionDispatch::Request.send(:include, Raisin::ApiFormat)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
raisin-0.1.2 lib/raisin/rails/request.rb