Class: Forem::PostsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/forem/posts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_forem_user, #current_user

Instance Method Details

#createObject


9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/forem/posts_controller.rb', line 9

def create
  @post = @topic.posts.build(params[:post])
  if @post.save
    flash[:notice] = t("forem.post.created")
    redirect_to [@topic.forum, @topic]
  else
    params[:reply_to_id] = params[:post][:reply_to_id]
    flash[:error] = t("forem.post.not_created")
    render :action => "new"
  end
end

#newObject


5
6
7
# File 'app/controllers/forem/posts_controller.rb', line 5

def new
  @post = @topic.posts.build
end