epf icon indicating copy to clipboard operation
epf copied to clipboard

Reserved model attribute names

Open dogawaf opened this issue 11 years ago • 4 comments

Hi Gordon

It seems that Epf have some reserved attribute names used internally on Ep.Model. For example, while migrating from Ember Data, I have a model with an attribute 'type'. It causes a "Call to underscore on 'undefined' " error, and take me a few minutes to figure it out. I have just renamed my attribute to something else than 'type', and all turns good.

Could you confirm that, and eventually document those reserved words ? I think about 'id', 'clientId', 'type', 'session', etc.

Cheers Rémy

dogawaf avatar Jul 25 '13 22:07 dogawaf

I can confirm there are some reserved attribute names. Off the top of my head they would be: rev, id, clientId, clientRev, and type.

I will definitely document all of these and will leave this open to address that.

ghempton avatar Jul 25 '13 22:07 ghempton

I don't want to complain, I think epf is a great library. But it would be neat if type, which is a common attribute, could be moved to _type or similar.

I know Ember Data switched from reference to _reference for the same reason.

sandstrom avatar Jul 31 '13 16:07 sandstrom

I'd agree with @sandstrom. This is trivial to workaround by just mapping the attributes on the adapter but I think it will likely trip up a lot of new users. rev and clientRev probably aren't real common, but clientId and especially type are likely to show up quite often. Would there be any issues with just moving these to the underscored versions?

jasonkriss avatar Jul 31 '13 19:07 jasonkriss

I also agree with @sandstrom. Would to use my type properties again.

miguelcobain avatar Sep 30 '13 14:09 miguelcobain