When using accepts_nested_attributes_for, instead of having to pass "child_attributes", I'd like to pass "child". I'm pretty sure if I put a lot of the logic in my controller to create the the records and children, I could accomplish this. However, in an effort to keep my controllers clean and logic where it should be, the model in this case, I'd like to know how to switch rails 3 around to use this syntax when doing a POST or PUT.
{
"name": "test",
"child_attributes": [
{
"id": 1,
"name": "test_child_update"
},
{
"name": "test_child_create"
}
}
Rather
{
"name": "test",
"child": [
{
"id": 1,
"name": "test_child_update"
},
{
"name": "test_child_create"
}
}
Evidently, this can't be done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With