Cleaned up the forum form
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user