使用 Ember 模型调用 Itinerary EmberData 正确地为 App.Itinerary.find()请求“ http://localhost.dev/itinenaries ”
但是,当 EmberData 请求单个模型时,请求看起来像App.Itinerary.find(1)的“ http://localhost.dev/itineraries?itinerary_id=2 ”
App = Ember.Application.create()
App.Itinerary = DS.Model.extend
title: DS.attr 'string'
description: DS.attr 'string'
App.ItineraryRoute = Em.Route.extend
model: (params) ->
App.Itinerary.find(params)
App.Store = DS.Store.extend()
DS.RESTAdapter.configure 'plurals',
itinerary: 'itineraries'
App.Router.map ->
@resource 'itineraries', ->
@resource 'itinerary', path: '/:itinerary_id', ->
干杯