findMany don't work


#1

Hi ,

I 'm using ember-data-1beta9. I use it with rails api backend. I don’t understand relationships… I arrive to manage a model like “post” but not an embeed model.

my bakend in url: /posts/1/

{

posts:
{
id:"1",
name: "post1",   
apps:[1]  
} }

i try to display comments but it don’t work:

router

@resource ‘posts’

@resource ‘post’, path: ‘/posts/:post_id’, ->

@route 'edit'
@resource 'apps'
@resource 'app', path: 'apps/:apps_id', ->
  @route 'edit'
  @route 'new'

routes

Appli.AppsRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, model: ->

@store.findMany('app') )

models

Appli.App = DS.Model.extend(

name: DS.attr(“string”)

post: DS.belongsTo(‘post’) )

Appli.Post = DS.Model.extend(

name: DS.attr(“string”)

apps: DS.hasMany(‘app’) )

The CRUD for post model work but if i try to watch apps , i’ve this error: “Error while processing route: apps” “factory is undefined”

Thks


#2

UPDATE I found … no needs “findMany”

I’ve just change my my “app” model.

apps: DS.hasMany(‘app’,async: true)

Now it work …