Reputation: 6660
I have an application in rails 3 using backbone.js
When I use @model.save, i got an ajax call like this :
{"_id"=>"4fb8febe7d552d0a5e000010",
"email"=>"[email protected]",
"invited_by_id"=>nil,
"invited_by_type"=>nil,
"role"=>"2",
"id"=>"4fb8febe7d552d0a5e000010"}
I don't have my model name as key of my post parameters. I was expecting :
{ "user" =>
{"_id"=>"4fb8febe7d552d0a5e000010",
"email"=>"[email protected]",
"invited_by_id"=>nil,
"invited_by_type"=>nil,
"role"=>"2",
"id"=>"4fb8febe7d552d0a5e000010"
}
}
How can i solve this problem?
Thank you
Upvotes: 0
Views: 201
Reputation: 13105
This is the role of url & urlRoot. Setting your model's urlRoot
to say /users
and configuring your server side routes accordingly does this job.
Upvotes: 2