dynamic DS.attr's #474

Closed
rmossuk opened this Issue Nov 14, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@rmossuk

rmossuk commented Nov 14, 2012

Hi all

Is it possible to somehow reopen a DS.Model and dynamically add more DS.attr's ?

Apparently you can do this like this
App.Post = DS.Model.extend(); App.Post.reopen({title: DS.attr('string')});

But say i have a Machine model and i want my users to be able to create a machine but to also be able to add additional fields to describe that machine. So these are different from other users.

Is this possible per instance ?

I then will store into mongodb so each document can have a different schema.

Has anyone any ideas how do so this or if this can / will be added as a future feature ?

thanks a lot
Rick

@igorT

This comment has been minimized.

Show comment
Hide comment
@igorT

igorT Apr 15, 2013

Member

There is now limited support for polymorphic records, but your server would need to support them. Other than that some people have custom mixins that do something similar. For now we are focused on improving stability. If you wanted to do something like this now, the easiest way might to have a tagging like system where you would put additional properties/tags into a hasMany on the model.

Member

igorT commented Apr 15, 2013

There is now limited support for polymorphic records, but your server would need to support them. Other than that some people have custom mixins that do something similar. For now we are focused on improving stability. If you wanted to do something like this now, the easiest way might to have a tagging like system where you would put additional properties/tags into a hasMany on the model.

@igorT igorT closed this Apr 15, 2013

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