Really strange truncation of ember-data


#1

I just try out emberjs on 1.1.2, i try a really simple example of posts with rails for testing, but EmberData call Started GET "/osts" instead Started GET "/posts"

I’ve seriously make a good attention of typo ! But no typo in my code.

//= require jquery
//= require jquery_ujs
//= require handlebars
//= require ember
//= require ember-data
//= require_self

EmberFirstTest.Store = DS.Store.extend
  revision: 11
  adapter: DS.RESTAdapter.create()

EmberFirstTest.Router.map ->
  @resource 'posts',
    path: '/posts',
  @resource 'post',
    path: '/post/:post_id'

EmberFirstTest.PostRoute = Ember.Route.extend(model: (params) ->
  @get('store').find 'post', params.post_id
)

EmberFirstTest.PostsRoute = Ember.Route.extend(model: (params) ->
  @get('store').findAll 'post'
)

EmberFirstTest = Ember.Application.create();

Of course my app response on http://0.0.0.0:3000/posts.json

[
  {
    title: foo
    post_body: null
    url: http://0.0.0.0:3000/posts/526f72504d616310af010000.json
  }
  {
    title: New post
    post_body: null
    url: http://0.0.0.0:3000/posts/526f72784d616310af020000.json
  }
]

#2

Ok i don’t understand why ! But resource must be in CamelCase

EmberFirstTest.PostRoute = Ember.Route.extend(model: (params) ->
  @get('store').find 'Post', params.post_id
)

EmberFirstTest.PostsRoute = Ember.Route.extend(model: (params) ->
  @get('store').findAll 'Post'
)

#3

In ember-data Revision 12 and older that is how it works, in the 1.0.0++ it is all just lower case. I would update to the latest beta of ember-data.

In fact you can call Post.findAll() in this version of ember-data, but all that is gone in 1.0.0++