Skip to content

Instantly share code, notes, and snippets.

@harrylove
Created July 9, 2010 20:43
Show Gist options
  • Save harrylove/470035 to your computer and use it in GitHub Desktop.
Save harrylove/470035 to your computer and use it in GitHub Desktop.
class ThingsController < ApplicationController
# curl -c mycookies localhost:3000/things/new
# The "-c" flag will create/overwrite a cookie file named "mycookies"
def new
render :json => { :authenticity_token => form_authenticity_token }
end
# curl -i -b cookies -d "test=hey&authenticity_token=[URLEncoded auth token]" localhost:3000/things
# The "-i" flag returns the response header (optional)
# The "-b mycookies" flag uses the cookie file from the previous request
# To URLEncode the auth string, just replace the "+" with "%2B"
def create
logger.info(params[:test])
render :nothing => true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment