Class: Forem::PostsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
# File 'app/controllers/forem/posts_controller.rb', line 8

def create
  @post = @topic.posts.create(params[:post].merge!(user_id: current_user.id))
  flash[:notice] = "Post has been created!"
  redirect_to topic_path(@topic)
end

#newObject



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

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