Skip to content

Instantly share code, notes, and snippets.

@thoraxe
Created March 25, 2014 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoraxe/9753476 to your computer and use it in GitHub Desktop.
Save thoraxe/9753476 to your computer and use it in GitHub Desktop.
class FilesController < ApplicationController
def create
file = CryptoFile.new
file.file_contents = params[:file_contents]
file.retrieve_key = (0..3).map {rand(10).to_s}.join
if Redis.current.set(file.id, file.to_json)
result = 1
else
result = 0
end
respond_to do |format|
format.json { render :json => result }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment