Skip to content

Instantly share code, notes, and snippets.

@giladmanor
Created February 27, 2013 23:37
Show Gist options
  • Save giladmanor/5052903 to your computer and use it in GitHub Desktop.
Save giladmanor/5052903 to your computer and use it in GitHub Desktop.
def get_token
token = "AKA #{params[:id]} #{Time.now.to_f}".hash
Rails.cache.write(token,params[:id], :timeToLive => 60.seconds)
render :json => token
end
def use_token
session[:user_id] = Rails.cache.read(params[:token])
redirect_to "/"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment