What's the history of Rails' json structure?


By default, when generating a widget scaffold, rails will send JSON down in a GET request like this:

{"name": "foo", "size": 5}

But will expect it sent up in a PATCH request like this:

{"widget": {"name": "foo", "size": 5}}

Anyone know the history/rational behind this?


With standard form methods the attributes are placed under the object kind. If you want to declare the param specifically - generally use the method _tag helpers which will have you explicitly declare the full params nesting.