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