Files
old-rijeci/app/controllers/application_controller.rb

21 lines
678 B
Ruby
Raw Normal View History

2013-12-09 03:23:49 +01:00
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
#before_filter :set_default_response_format
#
#private
#def set_default_response_format
# request.format = :json
#end
before_filter :allow_cors
def allow_cors
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
end