From 401197a895680f824f9aec9d82b25ae686e6b206 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 23 Sep 2010 15:20:19 +0000 Subject: Refactor: move #destroy_comment method to CommentsController#destroy git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4172 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/comments_controller.rb | 6 ++++++ app/controllers/news_controller.rb | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index c0d524a25..7432f831f 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -16,6 +16,12 @@ class CommentsController < ApplicationController redirect_to :controller => 'news', :action => 'show', :id => @news end + verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed } + def destroy + @news.comments.find(params[:comment_id]).destroy + redirect_to :controller => 'news', :action => 'show', :id => @news + end + private # ApplicationController's find_model_object sets it based on the controller diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index d15ae3291..47f467862 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -73,11 +73,6 @@ class NewsController < ApplicationController end end - def destroy_comment - @news.comments.find(params[:comment_id]).destroy - redirect_to :action => 'show', :id => @news - end - def destroy @news.destroy redirect_to :action => 'index', :project_id => @project -- cgit v1.2.3