Class: Recipes::RackCors
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- Recipes::RackCors
- Defined in:
- lib/potassium/recipes/rack_cors.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/potassium/recipes/rack_cors.rb', line 2 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 |