In the section "Hands On > Deleting Friends," the text states:
To support deletion on friends show route, we just need to add the same link with the action delete and implement the action.
In fact, the Delete link required in friends/show.hbs is not exactly the same as the previously shown link in friends/index.hbs.
Figuring out exactly why (and more importantly, how) the second link needed to be different was a nice little exercise for me, but future readers will probably appreciate a more explicit acknowledgment that the Delete link in index.hbs passes the model to the action by referencing a |friend| parameter that gets set in the #each block:
{{#each model as |friend|}}
...
...
<td><a href="#" {{action "delete" friend}}>Delete</a></td>
...
{{/each}}
Whereas in show.hbs, there is no block-scope variable friend to reference, therefore:
<a href="#" {{action "delete"model}}>Delete</a>
...is required.
Since the final version of show.hbs is never shown in the text (at least not in this section), this could be a major stumbling block for less experienced readers, especially those unfamiliar with the ruby syntax on which this is based.
In the section "Hands On > Deleting Friends," the text states:
In fact, the Delete link required in
friends/show.hbsis not exactly the same as the previously shown link infriends/index.hbs.Figuring out exactly why (and more importantly, how) the second link needed to be different was a nice little exercise for me, but future readers will probably appreciate a more explicit acknowledgment that the Delete link in
index.hbspasses the model to the action by referencing a|friend|parameter that gets set in the#eachblock:Whereas in
show.hbs, there is no block-scope variablefriendto reference, therefore:<a href="#" {{action "delete"model}}>Delete</a>...is required.
Since the final version of
show.hbsis never shown in the text (at least not in this section), this could be a major stumbling block for less experienced readers, especially those unfamiliar with the ruby syntax on which this is based.