Create new person with rest-client post request
I created an simple demo app, to experiment a little bit:
rails new rumba
rails g scaffold People name:string
Then i wrote an little programm to make an post request:
require 'rest_client'
response = RestClient.post 'localhost:3000/people', :people => {:name =>
'Joseph'}
puts response
So far it works and generates an new people. The only problem im facing is
that i think, that this wont work on heroku, because i provide no
authentikation token:
Started POST "/people" for 127.0.0.1 at 2013-09-09 00:08:10 +0200
Processing by PeopleController#create as XML
Parameters: {"person"=>{"name"=>"Joseph"}}
WARNING: Can't verify CSRF token authenticity
©[1m©[35m (0.0ms)©[0m begin transaction
©[1m©[36mSQL (2.0ms)©[0m ©[1mINSERT INTO "people" ("created_at",
"name", "upd
ated_at") VALUES (?, ?, ?)©[0m [["created_at", Sun, 08 Sep 2013 22:08:10
UTC +0
0:00], ["name", "Joseph"], ["updated_at", Sun, 08 Sep 2013 22:08:10 UTC
+00:00]]
So my question is how can i provide an authentication token in my
RestClient.post request?
No comments:
Post a Comment