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