Cannot retrieve items if 'data' keyword is used but no error message not explicit #1211

Closed
lauhub opened this Issue Sep 4, 2013 · 9 comments

Comments

Projects
None yet
7 participants

lauhub commented Sep 4, 2013

When using this:

App.Record = DS.Model.extend({
        name: attr('string')
        , data: attr('string')
});

App.Record.FIXTURES = [
    {
        id:10,
        name: "something",
        data:'test'
    }
];

We obtain the following error:

 (chrome) Uncaught RangeError: Maximum call stack size exceeded
 (firefox) too much recursion

At least a check shoud be done to indicate that 'data' word was used.

In other words: this is not fail-fast for now.

A document indicating which keywords cannot be used into DS.Model definition should also be provided.

This issue may be linked to emberjs/ember.js#2192 and #602 (please confirm).

Owner

wycats commented Sep 4, 2013

Good call. And yes, it's related to emberjs/ember.js#2192.

I'll add a way to get improved error messages for this to the beta3 milestone (I plan to ship beta2 today).

lauhub commented Sep 4, 2013

A good thing would also to exclude keywords like 'belongsTo', 'hasMany' and 'attr': it would save me some time since it happens I reverse some words.

Even if not master I am Yoda ;)

lauhub commented Sep 5, 2013

I give a suggestion I read from a StackOverflow topic: prefix all keywords with something like $ or _ or any acceptable non alphanum character.

(Angular uses $ as prefix from what I read there)

Owner

wagenet commented Oct 13, 2013

@wycats, am I correct in thinking this was switched to _data?

g-cassie commented Feb 3, 2014

I think there is still an issue with this. Looking at DS.belongsTo and asyncBelongsTo in beta6 they are still relying on the data property (not _data). As mentioned above, there is no error thrown, just very odd behaviour. Caused me a big headache over the weekend!

Owner

igorT commented May 28, 2014

👍 should at least error out for now.

Contributor

knownasilya commented Jun 6, 2014

This issue is covered by #602, since data is reserved.

Just spent an hour or so trying to figure this out. If possible, the error should definitely indicate that data is reserved.

Owner

igorT commented Jul 18, 2014

We added an error, but will make it actually work in the future

@igorT igorT closed this Jul 18, 2014

wehlutyk added a commit to science-en-poche/yelandur that referenced this issue Sep 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment