Skip to content

Commit

Permalink
Loading messages, and users in /#/messages
Browse files Browse the repository at this point in the history
  • Loading branch information
swinton committed Feb 19, 2013
1 parent 796b1a8 commit 83a4bd5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Simplest Ember.js REST example

A super-simple example application that uses the Ember.js REST adapter to load data from a RESTful API.

There are 2 data models: User and Message. Messages belong to a User, Users have many Messages.

# Usage

```bash
git clone [email protected]:swinton/simplest-emberjs-rest-example.git
cd src
python -m SimpleHTTPServer 3319 # and open http://localhost:3319/ in your browser :)
```

# Contact

@[steveWINton](http://twitter.com/steveWINton).
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<script type="text/x-handlebars" data-template-name="messages">
<h2>Messages</h2>
<p>Messages loads Messages from <tt>/messages</tt> but <strong>doesn&#039;t</strong> load related Users from <tt>/users</tt>. Why is this?</p>
<p>Messages loads Messages from <tt>/messages</tt> and loads related Users from <tt>/users</tt>.</p>
<ul>
{{#each message in controller}}
{{ log message }}
Expand Down
2 changes: 2 additions & 0 deletions src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ App.User = DS.Model.extend({
screen_name: DS.attr("string")
});


// Fixtures
App.Message.FIXTURES = [{
id: 1,
text: "Hello lovely world",
Expand Down
6 changes: 3 additions & 3 deletions src/messages
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
{
"id": 1,
"text": "Hello lovely world",
"user": 1
"user_id": 1
}, {
"id": 2,
"text": "Hello again",
"user": 1
"user_id": 1
}, {
"id": 3,
"text": "Goodbye, cruel world :(",
"user": 1
"user_id": 1
}
]
}

0 comments on commit 83a4bd5

Please sign in to comment.