CURL, Ruby on Rails, forms and testing forms with CURL

added on :: 10 October 2014

Get the cookie and save it locally

curl  --cookie-jar cookie | grep csrf

Then post the form

curl -d "note[content]=Look"   -X POST -d 

If you dont want CSRF validations add the bellow line in the controller

protect_from_forgery :except => [:new, :create] 
Then to submit a  form

curl -d "note[content]=Look"  method="post"

Also to rather than typing -d all the time you can JSON post it

curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST 
-d ' {"user":{"email":"", "password":"thatisasecret"}}'