Skip to content

Instantly share code, notes, and snippets.

View mklb's full-sized avatar
🍩
Download 👉🏻 Focus Dog App

Patrick mklb

🍩
Download 👉🏻 Focus Dog App
View GitHub Profile
@dhoelzgen
dhoelzgen / base_controller.rb
Last active October 7, 2021 16:19
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'