-
-
Save speed-of-light/37b2fff2acd1ff5d52d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Api | |
| module V0 | |
| class LinksController < ApplicationController | |
| # THIS | |
| before_action :set_headers | |
| def show | |
| @link = Link.find(params[:id]) | |
| render json: @link | |
| end | |
| private | |
| def link_params | |
| params.require(:status).permit(:title, :href, :comment) | |
| end | |
| # THIS | |
| 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 | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment