Skip to content

Instantly share code, notes, and snippets.

@iHiD
Created June 6, 2012 15:28
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 iHiD/2882640 to your computer and use it in GitHub Desktop.
Save iHiD/2882640 to your computer and use it in GitHub Desktop.
How to Build A Secure Website With Ruby On Rails 2
var form_data = //.. Serialise a form
// Get token and param from the meta tags
var token = $('meta[name="csrf-token"]').attr('content');
var param = $('meta[name="csrf-param"]').attr('content');
// Create url of "/settings/profile?name=Jeremy+Walker&authenticity_token=askdsalewg303y09sd00dshb0b00ac0dffbafds"
document.location = "/settings/profile?_method=PUT&" + form_data + "&" + token + "=" + param;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment