如何从Restkit + iOS发布到Rails

Joh*_*ohn 5 iphone ruby-on-rails restkit

我的Rails应用程序有一个带有"名称"属性的Post模型.我正在尝试使用RestKit从iOS创建一个新帖子.这是iOS代码.

NSDictionary* params = [NSDictionary dictionaryWithObject:@"amazingname" forKey:@"name"];
[[RKClient sharedClient] post:@"/posts" params:params delegate:self];
Run Code Online (Sandbox Code Playgroud)

这是在同一台机器上运行的服务器日志

    Started POST "/posts" for 127.0.0.1 at Tue May 10 15:39:14 -0700 2011
  Processing by PostsController#create as JSON
  Parameters: {"name"=>"amazingname"}
MONGODB blog_development['posts'].insert([{"_id"=>BSON::ObjectId('4dc9be92be2eec614a000002')}])
Completed 406 Not Acceptable in 4ms
Run Code Online (Sandbox Code Playgroud)

如您所见,服务器获取请求,但名称未保存到数据库中.创建一个无名的帖子.我的iOS代码有什么问题?

Joh*_*ohn 6

当我切换forKey时,它会起作用:@"name"为forKey:@"post [name]"