Signed-off-by: Adrian Hinz <adhinz@gmail.com>

This commit is contained in:
Adrian Hinz 2017-12-09 12:17:21 +01:00
parent 257631ea27
commit 7a98865b26
2 changed files with 0 additions and 16 deletions

View File

@ -3,19 +3,11 @@ class ApplicationController < ActionController::Base
before_action :authenticate_user!
before_action :set_locale
layout :layout_by_resource
after_action :set_headers
def set_locale
I18n.locale = params[:lang] || I18n.default_locale
end
def set_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'
headers['Access-Control-Request-Method'] = '*'
headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
end
protected
def layout_by_resource

View File

@ -13,14 +13,6 @@ module InvoiceKeeper
# -- all .rb files in that directory are automatically loaded.
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
config.i18n.default_locale = :pl
config.action_dispatch.default_headers.merge!({'X-Frame-Options' => 'ALLOWALL'})
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*', :headers => :any, :methods => [:get, :post, :options]
end
end
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
config.assets.precompile += %w( .svg .eot .woff .ttf .otf .woff2 )