I have a problem with resources in ember.js.
given these router:
App.Router.map ->
@route "index", path: "/"
@resource "transport_documents", ->
@resource "transport_document", path: ":transport_document_id"
and this routes:
App.TransportDocumentsRoute = Ember.Route.extend
model: -> App.TransportDocument.find()
App.TransportDocumentRoute = Ember.Route.extend
model: (params)->
App.TransportDocument.find(params.id)
/transport_documents
my server side call is: /api/transport_documents
, as expected/transport_documents/1
i expect this call is done: /api/transport_documents/1
, but it's not. no calls to my serverIs it an expected situation? if no, what should i do to force my app doing this query? I want more details in the show view, and less in the index.
thanks
params
will contain the dynamic segment name you specified. In your case you need to use:
model: (params)->
App.TransportDocument.find(params.transport_document_id)
See this example in the Ember routing guide for more information.