How to get current record to edit attribute?

// fund model (each fund record belongs to 1 strategy record)
    export default DS.Model.extend({
        fund: belongsTo('available-fund'),
        weight: DS.attr('number'),
        strategy: belongsTo('strategy'),

And this form.hbs

{{input type="text" class="form-control" required=true value=strategy.strategyName}}
{{#each strategy.strategyFunds as |fund|}}
    <td>Fund Weight: {{input type="text" class="form-control" value=fund.weight}}</td>
`<button type="button" class="btn btn-info mr-2" {{action 'updateStrategy' strategy}} >Save Strategy Changes</button>`

This is my action when the user clicks save, for now.

        updateStrategy(strategy) {

I want the user to be able to save the fund.weight value of each fund in a strategy, when the user actuates updateStrategy. What’s not clear is how to get the values from each {{input}} and the of each fund as well.

Hi! It looks like he way you are doing your template right now, the values of the inputs are available as weight attributes of each fund. When a user types something in, the weight is automatically being applied to the fund object. For example, add {{fund.weight}} in a div below the input, type in the input, and you’ll see the value change in 2 places. One option is that on updateStrategy, you could iterate over the strategy.strategyFunds and save each fund that has new information.

If you are using Ember Data, you can check if a fund has new data by using hasDirtyAttributes before saving. If funds belong to a strategy, by default the child records (funds) aren’t saved by calling save on the parent.

Does that help? I’m guessing a little at what might be confusing here.