add forum group destroying, fix forum destroy redirect

This commit is contained in:
jomo
2014-06-23 03:23:54 +02:00
parent f7b3045882
commit 58a5d6f02f
2 changed files with 14 additions and 1 deletions

View File

@@ -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 = [])

View File

@@ -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