You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve come across an unexpected behavior today and I wanted to investigate a little more about the cause. We ditched ember-data in one of our projects and, as a result, my route models aren’t instances of Ember.Object. This seems to be incompatible with the current CanMixin helper can.
Here is a dumbed-down example to explain my issue:
In this example, this.get('model') will always be null. Which is weird since this is how I've used this library in the past, and it's working when using the Handlebars helper.
I found out that the problem is related to this processing of the arguments which validates if the resource passed is an Ember.Object. If not, it sets resource to null and populate the properties instead.
As for now, the solution I’m using is to simply always pass some properties like this:
this.cannot('edit stuff',model,{});
I was wondering what was the use-case of switching these arguments. So, I have 2 questions:
Why do resource absolutely need to be an Ember.Object?
What could be the outcome of my solution since resource is not an Ember.Object?
Thanks for enlightening me 😊
Keep on the good work!
The text was updated successfully, but these errors were encountered:
Hi,
I’ve come across an unexpected behavior today and I wanted to investigate a little more about the cause. We ditched
ember-data
in one of our projects and, as a result, my route models aren’t instances ofEmber.Object
. This seems to be incompatible with the currentCanMixin
helpercan
.Here is a dumbed-down example to explain my issue:
In this example,
this.get('model')
will always benull
. Which is weird since this is how I've used this library in the past, and it's working when using the Handlebars helper.I found out that the problem is related to this processing of the arguments which validates if the
resource
passed is anEmber.Object
. If not, it setsresource
tonull
and populate theproperties
instead.As for now, the solution I’m using is to simply always pass some properties like this:
I was wondering what was the use-case of switching these arguments. So, I have 2 questions:
resource
absolutely need to be anEmber.Object
?resource
is not anEmber.Object
?Thanks for enlightening me 😊
Keep on the good work!
The text was updated successfully, but these errors were encountered: