Permalink
Browse files

Merge branch 'master' of ssh://github.com/mariusbutuc/StockMyFridge

  • Loading branch information...
2 parents 84658eb + f1b6cd6 commit aeaccbe72089b76184c509e1a57f50ac9fbbeca6 Chris Lancaster committed Nov 20, 2011
Showing with 7 additions and 1 deletion.
  1. +6 −0 app/controllers/recipes_controller.rb
  2. +1 −1 app/views/recipes/_recipe_list.html.erb
View
6 app/controllers/recipes_controller.rb
@@ -97,6 +97,12 @@ def create
end
end
+ def destroy
+ @recipe = Recipe.find(params[:id])
+ @recipe.destroy
+ redirect_to :controller => "recipes", :action => "index"
+ end
+
private
# Login to the system and retrieve the session key.
View
2 app/views/recipes/_recipe_list.html.erb
@@ -1,6 +1,6 @@
<% recipes.each do |recipe| %>
<li>
<%= recipe.name %>
- <%= image_tag("delete.png", :size=>"16x16")%>
+ <%=link_to image_tag("delete.png",:size=>"16x16"),recipe_path(recipe.id), 'data-method' => :delete, :class => "delete", :confirm => "Are you sure ?"%>
</li>
<% end %>

0 comments on commit aeaccbe

Please sign in to comment.