Sha256: a391fae92df0c3a328eb9b5dc601801ab919e09223fc4b0fb5803f7de1734daa

Contents?: true

Size: 680 Bytes

Versions: 7

Compression:

Stored size: 680 Bytes

Contents

module BetterFrameable
  extend ActiveSupport::Concern

  FALLBACK_ORIGIN_MESSAGE = <<-MSG
    set me using ENV["BETTER_FRAME_ORIGIN"]="http://my-host.com"
  MSG

  included do
    before_action :set_headers
    layout 'better_frame/application'
  end

  private
  def set_headers
    headers['Access-Control-Allow-Origin'] = ENV.fetch("BETTER_FRAME_ORIGIN", FALLBACK_ORIGIN_MESSAGE)
    headers['Access-Control-Allow-Credentials'] = "true"
    headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
    headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'
    headers['Access-Control-Max-Age'] = "1728000"
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
better_frame-0.3.3 lib/better_frame/better_frameable.rb
better_frame-0.3.2 lib/better_frame/better_frameable.rb
better_frame-0.3.1 lib/better_frame/better_frameable.rb
better_frame-0.3.0 lib/better_frame/better_frameable.rb
better_frame-0.2.0 lib/better_frame/better_frameable.rb
better_frame-0.1.2 lib/better_frame/better_frameable.rb
better_frame-0.1.1 lib/better_frame/better_frameable.rb