Cleaned up new topic form

This commit is contained in:
2013-01-22 10:49:55 -05:00
parent 652a7c2120
commit dd34326777
2 changed files with 18 additions and 17 deletions

View File

@@ -1,6 +1,8 @@
class TopicsController < ApplicationController
load_and_authorize_resource :forum
load_and_authorize_resource :topic, :through => :forum, :shallow => true
before_filter :check_for_cancel
def show
@topic.hit! if @topic
@@ -43,5 +45,11 @@ class TopicsController < ApplicationController
redirect_to forum_url(@topic.forum)
end
end
def check_for_cancel
if params[:commit] == 'cancel'
redirect_to @topic.new_record? ? @forum : @topic
end
end
end