Cleaned up the forum form

This commit is contained in:
ricky committed 2013-01-22 11:08:16 -05:00
1 parent dd34326777
commit 9cdcf46bf7
2 files changed
+23 -43

No files matched your search

+9 -1
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