diff --git a/Gemfile b/Gemfile index d7feb33..1f7143c 100644 --- a/Gemfile +++ b/Gemfile @@ -18,6 +18,7 @@ gem 'omniauth-reddit', :git => 'git://github.com/jackdempsey/omniauth-reddit.git gem 'active_model_serializers' gem 'paper_trail' gem 'paperclip', '~> 4.3' +gem 'rack-cors' # AUTHORIZATION gem 'pundit' diff --git a/Gemfile.lock b/Gemfile.lock index 4bd5ba6..d912618 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -145,6 +145,7 @@ GEM quiet_assets (1.1.0) railties (>= 3.1, < 5.0) rack (1.6.4) + rack-cors (0.4.0) rack-test (0.6.3) rack (>= 1.0) rails (4.2.4) @@ -253,6 +254,7 @@ DEPENDENCIES puma pundit quiet_assets + rack-cors rails (= 4.2.4) rails-erd rails_12factor diff --git a/config/application.rb b/config/application.rb index bfee894..bb8758a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,25 +11,17 @@ require "action_view/railtie" require "sprockets/railtie" # require "rails/test_unit/railtie" -# Require the gems listed in Gemfile, including any gems -# you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module DbzdokkanRails class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true + + config.middleware.insert_before 0, "Rack::Cors" do + allow do + origins '*' + resource '*', headers: :any, methods: [:get] + end + end end end