okfn/ckanjs — Issue #37: Mistakenly deduplicates new resources
Author: zephod
Created: 2012-03-01 20:14:36+00:00
State: open

This line is causing problems in the latest version of CKAN main:

https://github.com/okfn/ckanjs/blob/master/lib/model.js#L171

To replicate...

* Load up CKAN on my #1506 branch (this will be merged to master soon)
* Add New Dataset
* Leave title/url blank. This is invalid, which we want :-)
* Create two new unnamed resources
* Hit submit

Observe:

* You're back on the Add Resource page as expected, with some errors because the dataset has no URL.
* You've only got one resource!!

CKAN got it right: A JSON object called preload_dataset was embedded in the page with both resources. Then this happened: ```var _dataset = new CKAN.Model.Dataset(preload_dataset);``` The translation to CkanJS objects mistakenly deduplicates these resources because neither of them have IDs.

I don't know the correct way to rearchitect CKANJS to handle resources without IDs.