Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialManas sricharan VARRI
8,242 PointsQuestion on Delete Method
<tbody>
<% @statuses.each do |status| %>
<tr>
<td><%= status.name %></td>
<td><%= status.content %></td>
<td><%= link_to 'Show',status%></td>
<td><%= link_to 'Edit', edit_status_path(status) %></td>
<td><%= link_to 'Destroy',status, method: :delete, data: { confirm: 'Are you sure?'} %></td>
</tr>
<% end %>
</tbody>
This is my code in the index.html.erb file and my code in statuses_controller.rb ,destroy function code is like
def destroy
@status.destroy
respond_to do |format|
format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }
format.json { head :no_content }
end
end
The show and Edit methods are working , but when ever i click on the destroy method ,it's again showing the status and isn't deleting the status.
Thanks in advance.