alexbain/backbone-firebase — pull request #1 by thruflo (2012-07-31 13:57:58+00:00)
Title: Set `model.id` and handle change/remove events.

Previously, the lib did not set the model.id attribute when populating a
collection from firebase. This meant that the models could not be identified
when `child_changed` or `child_removed` events came down the pipe.

This commit introduces a configurable `idAttribute`, which is populated with
the firebase reference name. Implementations then need to set the `idAttribute`
of their model class to use this as the source for the `model.id` value.

I've updated the readme accordingly but it might be worth providing a
`FirebaseModel` class that does this automatically, or generally considering
the best implementation.

In addition, I've patched up the update and delete event handlers to get the
existing model by id (rather than trying to `collection.get(pushed_mode.val())`.