Class: Forem::TopicsController
Instance Method Summary
collapse
#authenticate_forem_user, #current_user
Instance Method Details
#create ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/forem/topics_controller.rb', line 14
def create
@topic = Forem::Topic.new(params[:topic])
@topic.user = current_user
@topic.forum_id = params[:forum_id]
if @topic.save
flash[:notice] = t("forem.topic.created")
redirect_to [@forum, @topic]
else
flash[:error] = t("forem.topic.not_created")
render :action => "new"
end
end
|
#new ⇒ Object
9
10
11
12
|
# File 'app/controllers/forem/topics_controller.rb', line 9
def new
@topic = @forum.topics.build
@topic.posts.build
end
|
#show ⇒ Object
5
6
7
|
# File 'app/controllers/forem/topics_controller.rb', line 5
def show
@topic = @forum.topics.find(params[:id])
end
|