Sha256: e47fb6860fcce05be87ecaec9b7c7e0d9aecae5ae9fa88064fae0925e8dac478

Contents?: true

Size: 578 Bytes

Versions: 5

Compression:

Stored size: 578 Bytes

Contents

class Recipes::RackCors < Rails::AppBuilder
  def create
    gather_gem('rack-cors', '~> 0.4.0')
    after(:gem_install) do
      rack_cors_config =
        <<-RUBY.gsub(/^ {7}/, '')
           config.middleware.insert_before 0, Rack::Cors do
             allow do
               origins '*'
               resource '*',
                 headers: :any,
                 expose: ['X-Page', 'X-PageTotal'],
                 methods: [:get, :post, :delete, :put, :options]
             end
           end
           RUBY

      application rack_cors_config.strip
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
potassium-5.1.4 lib/potassium/recipes/rack_cors.rb
potassium-5.1.3 lib/potassium/recipes/rack_cors.rb
potassium-5.1.2 lib/potassium/recipes/rack_cors.rb
potassium-5.1.1 lib/potassium/recipes/rack_cors.rb
potassium-3.0.0 lib/potassium/recipes/rack_cors.rb