ruby on rails - curl command line POST -


i'm trying simulate post simple rails scaffold web service. files created scaffold have not been changed. when post data website form, record created correctly.

when attempt post curl, record created in database, has null values in fields, except 'updated_at' , 'created_at'. i'm new command line curl may not doing correctly.

curl -d "name=gazoo&friend=rubble" localhost:3000/flintstones 

i webrick:

started post "/flintstones" 127.0.0.1 @ thu apr 28 18:04:47 -0600 2011 processing flintstonescontroller#create parameters: {"name"=>"gazoo", "friend"=>"rubble"} arel (0.3ms) insert "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 http://localhost:3000/flintstones/4

after 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 null in fields?

thanks in advance.

i've googled bit , every example of using curl rails web service shows parameters passed in format

object[paramname]=paramvalue

as 1 -d set each parameter make curl statement

curl -d "flintstone[name]=gazoo" -d "flintstone[friend]=rubble" localhost:3000/flintstones

here sources i'm referencing:


Comments