emberjs/data — pull request #58 by siebertm (2012-01-20 08:43:59+00:00)
Title: implement support for singleton resources for DS.RESTAdapter

In order to support working with singleton resources, I modified the RESTAdapter to take the different URL scheme into account for that.
While fiddling with the URLs, I also made the calculations of URLs consistent (e.g. deleteRecord used the primaryKey attribute, while all others hard-coded 'id' as primary key)

Defining a singleton resource is pretty easy:

```javascript
App.User = DS.Model.extend();
App.User.reopenClass({
isSingleton: true
})
```

This pull request is by no means complete, since IMO we need to discuss about the API for that.

* how do i find such a singleton resource? DS.Store doesn't know about singletons, so these don't work:

```javascript
App.store.find(User) # no ID, no query
App.store.find(User, 1) # but the found user most likely isn't ID 1, so the mapping clientId <=> ID breaks
App.store.findAll(User) # would then return a ModelArray with exactly 1 model. works but sucks
```

Maybe we should introduce a findFirst() API method to DS.Store and Adapter?

* how do we cope with the bulk methods? just throw an error?
* no docs yet (until the other stuff is settled)

Just give me some feedback on how you think it should work, i'll fix that then