You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
In the section "Hands On > Deleting Friends," the text states:
In fact, the Delete link required in
friends/show.hbs
is 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.hbs
passes the model to the action by referencing a|friend|
parameter that gets set in the#each
block:Whereas in
show.hbs
, there is no block-scope variablefriend
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.The text was updated successfully, but these errors were encountered: