From 58a5d6f02f7f1740fc2b7591d2520ceb97915d37 Mon Sep 17 00:00:00 2001 From: jomo Date: Mon, 23 Jun 2014 03:23:54 +0200 Subject: [PATCH] add forum group destroying, fix forum destroy redirect --- app/controllers/forumgroups_controller.rb | 13 +++++++++++++ app/controllers/forums_controller.rb | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/controllers/forumgroups_controller.rb b/app/controllers/forumgroups_controller.rb index bff18c5..95f372b 100644 --- a/app/controllers/forumgroups_controller.rb +++ b/app/controllers/forumgroups_controller.rb @@ -56,6 +56,19 @@ class ForumgroupsController < ApplicationController end end + def destroy + if admin? + if @group.destroy + flash[:notice] = "forum group deleted." + else + flash[:alert] = "Something went wrong" + end + else + flash[:alert] = "You are not allowed to delete forum groups." + end + redirect_to forums_path + end + private def group_params(add = []) diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 48bfec1..042623d 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -63,7 +63,7 @@ class ForumsController < ApplicationController flash[:notice] = "Forum deleted." else flash[:alert] = "Something went wrong" - render :new + redirect_to @forum return end else