ember.js - Emberjs + ember-data find with param -


i'm trying find model based on param :

this.store.find('slide', {slidecategory: category}); 

but return : (edit full stack trace)

typeerror: cannot read property 'length' of undefined @ hi.extend.pushmany (ember-data.min.js?551b0279246c3:3) @ dr.extend.load (ember-data.min.js?551b0279246c3:1) @ ember-data.min.js?551b0279246c3:1 @ trycatch (ember.debug.js?551b0279246c3:46898) @ invokecallback (ember.debug.js?551b0279246c3:46910) @ publish (ember.debug.js?551b0279246c3:46881) @ ember.debug.js?551b0279246c3:27205 @ queue.invoke (ember.debug.js?551b0279246c3:871) @ object.queue.flush (ember.debug.js?551b0279246c3:936) @ object.deferredactionqueues.flush (ember.debug.js?551b0279246c3:741) 

i'm running code action in slideroute.

here slide model looks like

app.slide = ds.model.extend({     title: ds.attr('string'),     note: ds.attr('string'),     slidecategory: ds.belongsto('slidecategory') }); 

and slidecategory model

app.slidecategory = ds.model.extend({     title: ds.attr('string'),     slides: ds.hasmany('slide', {async:true}) }); 

it's running fixtures , here 1 record :

{      id: 1,      slidecategory: 1,     title: 'slide 1',      note: 'lorem ipsum dolor sit amet, consectetur adipiscing elit. suspendisse eget hendrerit lacus. donec venenatis sagittis turpis aliquet. ut nec ipsum ac sem lobortis ultrices id eu ante. aenean ut vehicula odio, non imperdiet risus. aenean mattis diam nec nulla tincidunt, vitae vehicula dui vehicula.',  } 

i'm using ember 1.11 , ember-data 1.0.0-beta.16

edit

all right, seems problem related querying fixtures, isnt supported default ember-data.

let's go other option slides , use following piece of code

this.store.find('slidecategory', category).then(function(slidecategory){     slidecategory.get('slides').then(function(slides){      }    } 

i have expected following piece of code give me array of slides on loop object seems different.

this :

class {     __ember1427894067627: null     __ember_meta__: object     __nextsuper: undefined     canonicalstate: array[3]         0: class         1: class         2: class     length: 3     __proto__: array[0]     currentstate: array[3]     isloaded: true     ispolymorphic: undefined     length: 3     record: class     relationship: ember$data$lib$system$relationships$state$has$many$$manyrelationship     store: class     type: app.slide     __proto__: class 

this seems don't know how loop through object. seems 3 elements in canonicalstate array 3 slides i'm looking for. when open class object slide object like.

sorry if seems stupid i'm new ember , not find answer question.

don't use minified version of ember-data leaves out lot of debugging information. pushmany function should receive array , there ember.assert guards in place tell nice error message whats going on. minified version should used in production not in tests.

this explains why don't error message fixture adapter not supporting queries.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -