Given an author named 'Alan Turing'
When users visit the authors index page
Then it should have link to delete an author
Hints
In order to delete a record according to the REST paradigm, a DELETE request needs to be made.
Unfortunately, not many browsers support this directly.
However, the DELETE call can be made using JavaScript from the browser.
Rails supports this out of the box by including a piece of JavaScript.
Using the data-method property of links, a different request can be made. This is also supported by Rails helpers:
<%= link_to 'Delete', author_path(author), method: :delete %>
After an author is deleted Author.count should have decreased.
A destroy controller action is needed.
Here is the relevant section (5.13) of the Rails Guide.
Error
Expected to find css "a[data-method='delete'][href='/authors/1']" but there were no matches
18 exercise tests have passed. There are 44 in total. You will solve multiple at once towards the end.
Scenario
Given an author named 'Alan Turing' When users visit the authors index page Then it should have link to delete an author
Hints
In order to delete a record according to the REST paradigm, a DELETE request needs to be made. Unfortunately, not many browsers support this directly. However, the DELETE call can be made using JavaScript from the browser. Rails supports this out of the box by including a piece of JavaScript.
Using the
data-method
property of links, a different request can be made. This is also supported by Rails helpers:<%= link_to 'Delete', author_path(author), method: :delete %>
After an author is deletedAuthor.count
should have decreased.A
destroy
controller action is needed. Here is the relevant section (5.13) of the Rails Guide.Error
18 exercise tests have passed. There are 44 in total. You will solve multiple at once towards the end.