Pregunta

im trying to save a few models with one to one relation which initializes on a single controller action. Ive split things into small functions to use promises. I've been trying to make it work for almost a week and cant find the solution. I've also made a jsbin: http://jsbin.com/enoYONAv/1/edit

¿Fue útil?

Solución

Instead of valueBinding you can use selectionBinding in your Ember.Select, to retrieve the selected model directlly instead of your id. For example:

{{
   view Ember.Select
   prompt="Gender"
   contentBinding="genders"
   optionValuePath="content.id"
   optionLabelPath="content.type"
   selectionBinding="selectedGender"
}}

So in you action you can do:

var gender = this.get('selectedGender');

...

var hash = {
    name : personName,
    gender : gender,
    organization : organization
};

this.savePerson(hash).then(this.saveAgentAssociation(agentAddress));

This is your updated jsbin please give a look http://jsbin.com/efeReDer/1/edit

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top