Cleaned up the forum form

This commit is contained in:
2013-01-22 11:08:16 -05:00
parent dd34326777
commit 9cdcf46bf7
2 changed files with 23 additions and 43 deletions

View File

@@ -2,6 +2,8 @@ class ForumsController < ApplicationController
load_and_authorize_resource :category
load_and_authorize_resource :forum, :through => :category, :shallow => true
before_filter :check_for_cancel
def create
if @forum.save
flash[:notice] = "Forum was successfully created."
@@ -24,4 +26,10 @@ class ForumsController < ApplicationController
redirect_to forums_url
end
end
end
def check_for_cancel
if params[:commit] == 'cancel'
redirect_to @forum.nil? ? forum_path(@forum) : forums_path
end
end
end