Open dev-inigmas opened 10 years ago
Okay, so it seems like "Bindings" are interfering the session's ability to flush.
I have some business logic in some of my models. In one case, I tried making a property of a related model easier to access by creating a binding to it. For instance:
App.Foo = Ep.Model.extend
name: Ep.attr 'string'
bar: Ep.belongsTo 'bar'
bvBinding: 'bar.value'
App.Bar = Ep.Model.extend
value: Ep.attr 'number'
foos: Ep.hasMany 'foo', inverse: 'bar'
Replacing with binding with a computed property seems to be a good workaround for now.
Ah I could see this happening in some binding cases. I am working on a refactor that could fix some of these issues.
On Wed, Jul 16, 2014 at 1:02 AM, David Patrick notifications@github.com wrote:
Okay, so it seems like "Bindings" are interfering the session's ability to flush.
I have some business logic in some of my models. In one case, I tried making a property of a related model easier to access by creating a binding to it. For instance:
App.Foo = Ep.Model.extend name: Ep.attr 'string' bar: Ep.belongsTo 'bar' bvBinding: 'bar.value'
App.Bar = Ep.Model.extend value: Ep.attr 'number' foos: Ep.hasMany 'foo', inverse: 'bar'
Replacing with binding with a computed property seems to be a good workaround for now.
— Reply to this email directly or view it on GitHub https://github.com/getoutreach/epf/issues/142#issuecomment-49134913.
Gordon L. Hempton http://codebrief.com 360.460.8098
Also, fwiw, I would recommend using computed property aliases rather than bindings (which are eagerly evaluated). In your case it would be bv: Ember.computed.alias('bar.value')
I just got an error that seems pretty weird to me.
Not really sure what seems to be going on. Basically, I'm trying to set an object to the primary model's "belongsTo" attribute. And then flush the session. I've done some print outs that the model I'm setting has a Session. (Should be the same session as the parent model). But I'm consistently getting this error.
Any ideas?