Rolling with Ruby on Rails
Subject:   Homework #1 issues
Date:   2006-09-11 20:54:52
From:   m3_del
I am atempting to add a delete ("destroy") link at the end of the listing table. my HTML is as follows.

<title>All Recipes</title>

<h1>Online Cookbook - All Recipes</h1>
<table border="1">
<td width="40%>

<td width="20%">

<td width="20%>

<td width="20%">


<% @recipes.each do |recipe| %>
<td><%= link_to recipe.title, :action => "show", :id => %></td>
<td><%= %> </td>
<td><%= %></td>
<td><%= link_to "Delete", :action => "destroy", :id => %></td>
<% end %>

<%= link_to "Create new recipe", :action => "new" %>


I believe I get the correct link but It just reloads the list view. In the original list view when you click destroy it gives you a popup to confirm deletion. What am I missing?

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • Homework #1 issues
    2006-09-11 20:58:12  m3_del [View]

    <td><%= link_to "Delete", :action => "destroy", :id => %></td>

    This is the line I am refering to in the above code. Sorry it seemed to format that all a little weird
    • Homework #1 issues
      2006-09-15 03:54:37  StBob [View]

      I've been laborating a bit with that stuff too and it seems like the destroy function want somekind of confirmation.

      <%= link_to "Delete", {:action => "destroy", :id => },
      :confirm => 'Are you sure?', :post => true %>

      This code works, I don't really know why, but I think it is because of the :post => true snippet.

      I hope that helps.