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
References: | |
http://blog.carbonfive.com/2012/02/27/supporting-cross-domain-ajax-in-rails-using-jsonp-and-cors/ | |
https://github.com/cyu/rack-cors | |
http://nelm.io/blog/2011/11/cors-with-sencha-touch/ | |
http://jessehowarth.com/2011/04/27/ajax-login-with-devise | |
============================================================================================================= | |
GEMFILE | |
============================================================================================================= | |
gem 'rack-cors', :require => 'rack/cors' |
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
class ApiController < ApplicationController | |
# define which model will act as token authenticatable | |
acts_as_token_authentication_handler_for Login | |
# Prevent CSRF attacks by raising an exception. | |
# For APIs, you may want to use :null_session instead. | |
protect_from_forgery with: :null_session | |
respond_to :json | |
skip_before_filter :verify_authenticity_token, if: :json_request? |
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
using WithMacro; | |
typedef Player = { | |
final name:String; | |
final level:Int; | |
} | |
class Main { | |
static function main() { | |
var player = {name: "Dan", level: 15}; |