I have the following models:
Variant = DS.Model.extend
value: DS.hasMany('value')
compiledValues: (->
@get('values').map((v,i,e) ->
v.get('option').get('name') + ' : ' + v.get('value')
).join("\n")
).property('values.@each.value', 'values.@each.option.name')
Value = DS.Model.extend
option: DS.belongsTo('option')
Option = DS.Model.extend
values: DS.hasMany('values')
The problem I'm having is the the computed property compiledValues
is only updated when I modify the value of one of the values, not when the option name changes.
See the jsbin demonstration
I have a workaround which adds a optionName
onto the Value
like below, but shouldn't I be able to bind as I'm trying above?
optionName: Ember.computed.alias('option.name')