I'm trying to simulate a POST to my simple Rails scaffold web service. The files created by the scaffold have not been changed. When I POST data from the website form, a record is created correctly.
When I attempt to POST with curl, a record is created in the database, but it has NULL values in the fields, except for 'updated_at' and 'created_at'. I'm new to command line curl so I may not be doing it correctly.
curl -d "name=Gazoo&friend=Rubble" localhost:3000/flintstones
I get back this from WEBrick:
Started POST "/flintstones" for 127.0.0.1 at Thu Apr 28 18:04:47 -0600 2011 Processing by FlintstonesController#create as Parameters: {"name"=>"Gazoo", "friend"=>"Rubble"} AREL (0.3ms) INSERT INTO "flintstones" ("name", "friend", "created_at", "updated_at") VALUES (NULL, NULL, '2011-04-29 00:04:47.779902', '2011-04-29 00:04:47.779902') Redirected to http://localhost:3000/flintstones/4
After a GET for the json
curl localhost:3000/flintstones.json
I receive:
[{"flintstone:{"name":null,"created_at":"2011-04-29T00:09:58Z","updated_at":"2011-04-29T00:09:58Z","id":4,"friend":null}}]
Why do I get null in my fields?
Thanks in advance.