Class: Recipes::RackCors

Inherits:
Rails::AppBuilder
  • Object
show all
Defined in:
lib/potassium/recipes/rack_cors.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/potassium/recipes/rack_cors.rb', line 6

def create
  gather_gem('rack-cors', '~> 0.4.0')
  after(:gem_install) do
    rack_cors_config =
      "        config.middleware.insert_before 0, Rack::Cors do\n          allow do\n            origins '*'\n            resource '*',\n              headers: :any,\n              expose: ['X-Page', 'X-PageTotal'],\n              methods: [:get, :post, :delete, :put, :options]\n          end\n        end\n\n      RUBY\n\n    application rack_cors_config\n  end\nend\n"

#installObject



2
3
4
# File 'lib/potassium/recipes/rack_cors.rb', line 2

def install
  create
end