cakephp/cakephp — pull request #548 by scottharwell (2012-03-06 17:15:05+00:00)
Title: Form helper url id

Currently, the form helper will auto set the `id` of the current item if the url contains an `id`. I found myself wanting to prevent this in certain scenarios, such if I wanted to post to a route with a .json extension in order to use the ajax/iframe file post method.

```
Form->create(
'User',
array(
'url' => array(
'plugin' => 'my_plugin',
'controller' => 'users',
'action' => 'edit.json',
'admin' => true,
'id' => null
),
'type' => 'file',
);
?>
```

Without this fix, the form helper would create a url like below, which breaks the routing.

`/admin/my_plugin/users/edit.json/1`

I couldn't find any similar tickets on Lighthouse, so I created this update to the form helper in order for one to be able set the `id` parameter if they so choose. Setting to null prevents the `id` from being part of the url resulting in the url below.

`/admin/my_plugin/users/edit.json`

Another possible solution could be to add an extension parameter to the url array to append the extension to the last passed variable.

`/admin/my_plugin/users/edit/1.json`