Deleting a Sighting

Every so often a reported cryptid sighting turns out to be a hoax. While this may be rare, you do need a way to delete old or debunked data. Recall from Chapter 21 that destroying records is achieved by calling record.destroyRecord. Simple enough.

Make it so: Add a delete button to your template in app/templates/sighting/edit.hbs.

  <button type="submit" class="btn btn-info btn-block">Update</button>
  <button {{action 'cancel'}} class="btn btn-block">Cancel</button>
</form>

<hr>
<button {{action 'delete'}} class="btn btn-block btn-danger">
  Delete
</button>

In addition to the new button, you added a horizontal rule (a simple line) between the form elements to separate the Update and Cancel buttons from the ...

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.