Inspecting ember data models (attributes)


#1

Hiya,

I’m building an app where I need to list the fields in an Ember Data model. I’m fairly new to Ember, so I hope my question is not too off :wink: My problem is I need to somehow inspect the models to get a list of attributes, based on the name of the model (chosen in another select box), but the examples I’ve found doesn’t really work for me. I have been looking at this problem for a day now, with little success and it’s starting to annoy me now :sweat:

Bascially I want to create a dropdown box with fields defined in the model from a computed property inside my controller.

I’ve tried to get the attributes from the model like this:

this.store.modelFor(‘customer’).attributes

But it seem to lack the internal model and meta, so i’m a little uncertain what would be the best approach to accomplish this?

Additionally I need to get access to the options (listId) defined in the attr, like this, if possible.

status: DS.belongsTo(‘picklist-item’, {listId: 123, async: true}),

Does it make any sense?

Thank you… /Allan