Women in Technology

Hear us Roar



Article:
  Rolling with Ruby on Rails Revisited, Part 2
Subject:   Destroy method does nothing.
Date:   2007-08-16 13:39:50
From:   gbbailey78
Hi, I've followed the tutorial (very clear - thanks!) and all has gone swimmingly, apart from my attempts to delete. This is true for both categories and recipes. When I press delete it just goes back to the list.


In the recipe_controller I have:
def destroy
Recipe.find(params[:id]).destroy
redirect_to :action => 'list'
end


The following appears in my development log under the cookbook2 app.



Processing RecipeController#destroy (for 127.0.0.1 at 2007-08-16 21:26:52) [GET]
Session ID: d5109ae98d36e8f33bd0d0fbb0c3961e
Parameters: {"action"=>"destroy", "id"=>"2", "controller"=>"recipe"}
Redirected to http://localhost:3000/recipe/list
Filter chain halted as [#<ActionController::Filters::ClassMethods::ProcFilter:0x46cc0ec @filter=#<Proc:0x03da192c@C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/verification.rb:74>>] returned false.
Completed in 0.01500 (66 reqs/sec) | DB: 0.00000 (0%) | 302 Found [http://localhost/recipe/destroy/2]



Processing RecipeController#list (for 127.0.0.1 at 2007-08-16 21:26:52) [GET]
Session ID: d5109ae98d36e8f33bd0d0fbb0c3961e
Parameters: {"action"=>"list", "controller"=>"recipe"}
Recipe Load (0.000000) SELECT * FROM recipes 
Rendering within layouts/application
Rendering recipe/list
Recipe Columns (0.015000) SHOW FIELDS FROM recipes
DEPRECATION WARNING: Passing :post as a link modifier is deprecated. Use :method => "post" instead. :post will be removed in Rails 2.0. See http://www.rubyonrails.org/deprecation for details. (called from convert_options_to_javascript! at C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/helpers/url_helper.rb:331)
Category Columns (0.000000) SHOW FIELDS FROM categories
Category Load (0.000000) SELECT * FROM categories WHERE (categories.`id` = 2) 
DEPRECATION WARNING: Passing :post as a link modifier is deprecated. Use :method => "post" instead. :post will be removed in Rails 2.0. See http://www.rubyonrails.org/deprecation for details. (called from convert_options_to_javascript! at C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/helpers/url_helper.rb:331)
Category Load (0.000000) SELECT * FROM categories WHERE (categories.`id` = 5) 
DEPRECATION WARNING: Passing :post as a link modifier is deprecated. Use :method => "post" instead. :post will be removed in Rails 2.0. See http://www.rubyonrails.org/deprecation for details. (called from convert_options_to_javascript! at C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/helpers/url_helper.rb:331)
Category Load (0.000000) SELECT * FROM categories WHERE (categories.`id` = 5) 
Completed in 0.04700 (21 reqs/sec) | Rendering: 0.03200 (68%) | DB: 0.01500 (31%) | 200 OK [http://localhost/recipe/list]


It doesn't appear to be a permissions thing as I can quite happily delete the entries using mysql (although I must confess to having never used mysql before).



Main Topics Newest First

Showing messages 1 through 1 of 1.

  • Destroy method does nothing [SOLVED]
    2007-08-16 13:44:40  gbbailey78 [View]

    Typical. I spend ages trying to sort something out, and then as soon as I post I solve it.

    Firefox + scripts disabled = No delete.

    Sorry!