Skip to content
This repository has been archived by the owner on Aug 25, 2018. It is now read-only.

Commit

Permalink
Docs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davideast committed Nov 23, 2014
1 parent 087590a commit 7cbda00
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,14 @@ You may also apply an `orderByChild` or some other
[query](https://www.firebase.com/docs/web/guide/retrieving-data.html#section-queries) on a
reference and pass it in:

### Queries

```javascript
var TodoList = Backbone.Firebase.Collection.extend({
url: new Firebase('https://<your-firebase>.firebaseio.com/todos').orderByChild('importance')
});
```

Any models added to the collection will be synchronized to the provided Firebase. Any other clients
using the Backbone binding will also receive `add`, `remove` and `changed` events on the collection
as appropriate.
Expand Down Expand Up @@ -199,12 +202,25 @@ may extend this object, and must provide a Firebase URL or a Firebase reference
property.

```javascript
var MyTodo = Backbone.Firebase.Model.extend({
var Todo = Backbone.Firebase.Model.extend({
url: "https://<your-firebase>.firebaseio.com/mytodo"
});
```
You may apply query methods as with `Backbone.Firebase.Collection`.

### urlRoot
```javascript

var Todo = Backbone.Firebase.Model.extend({
urlRoot: 'https://<your-firebase>.firebaseio.com/todos'
});

// The url for this todo will be https://<your-firebase>.firebaseio.com/todos/1
var todo = new Todo({
id: 1
});
```

**BE AWARE!** You do not need to call any functions that will affect _remote_ data. If autoSync is enabled and you call
`save()` or `fetch()` on the model, **the library will ignore it silently**.

Expand Down

0 comments on commit 7cbda00

Please sign in to comment.