Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added destroy link

  • Loading branch information...
commit c71582cca672c3b12a7c4b3898c60fe44d586ed2 1 parent 397b094
Chris Tosswill authored
4 .bundle/config
View
@@ -1,2 +1,2 @@
----
-BUNDLE_DISABLE_SHARED_GEMS: "1"
+--- {}
+
2  app/controllers/lists_controller.rb
View
@@ -76,7 +76,7 @@ def destroy
@list.destroy
respond_to do |format|
- format.html { redirect_to(lists_url) }
+ format.html { redirect_to(tasks_url) }
format.xml { head :ok }
end
end
3  app/models/list.rb
View
@@ -1,5 +1,6 @@
class List < ActiveRecord::Base
- has_many :tasks
+ has_many :tasks , :dependent => :destroy
+
def done_tasks
tasks.where(:done => true).order("updated_at DESC")
2  app/views/lists/index.html.erb
View
@@ -13,7 +13,7 @@
<td><%= list.name %></td>
<td><%= link_to 'Show', list %></td>
<td><%= link_to 'Edit', edit_list_path(list) %></td>
- <td><%= link_to 'Destroy', list, :confirm => 'Are you sure?', :method => :delete %></td>
+ <td></td>
</tr>
<% end %>
</table>
2  app/views/tasks/index.html.erb
View
@@ -68,7 +68,7 @@
<% end %>
</ul>
<% end %>
-
+ <%= link_to 'Delete this list', list, :confirm => 'Are you sure?', :method => :delete %>
</div>
<% @count += 1%>
2  tmp/pids/server.pid
View
@@ -1 +1 @@
-23111
+37692
Please sign in to comment.
Something went wrong with that request. Please try again.