Skip to content

Instantly share code, notes, and snippets.

@bhserna
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhserna/8def6adfed419e7961fa to your computer and use it in GitHub Desktop.
Save bhserna/8def6adfed419e7961fa to your computer and use it in GitHub Desktop.
carros
{{model.name}}
App = Ember.Application.create()
App.cars = [
{ id: "1", name: "Chevy" },
{ id: "2", name: "Focus" }
]
App.Router.map ->
@resource "cars", path: "/cars", ->
@resource "car", path: ":car_id"
App.CarsRoute = Ember.Route.extend
model: ->
App.cars
App.CarsIndexRoute = Ember.Route.extend
model: ->
@modelFor "cars"
App.CarRoute = Ember.Route.extend
model: (params) ->
@modelFor("cars").findBy("id", params.car_id)
{{outlet}}
<ul>
{{#each car in model}}
<li>{{car.name}}</li>
{{/each}}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment