Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on "Deleting Friends" #67

Open
paul-howard opened this issue Jun 3, 2016 · 0 comments
Open

Clarification on "Deleting Friends" #67

paul-howard opened this issue Jun 3, 2016 · 0 comments

Comments

@paul-howard
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant