Sha256: f28961b6c0bcaac499612fefc4ec5f6233e455a0fa0ca91df2aa613959baa9d8

Contents?: true

Size: 563 Bytes

Versions: 2

Compression:

Stored size: 563 Bytes

Contents

require_dependency "forem/application_controller"

module Forem
  class PostsController < ApplicationController    
    before_filter :authenticate_forem_user!, :only => [:new, :create]
  	before_filter :find_topic

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

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

  	private

  	def find_topic
  		@topic = Forem::Topic.find(params[:topic_id])
  	end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redlumxn-forem-0.0.2 app/controllers/forem/posts_controller.rb
redlumxn-forem-0.0.1 app/controllers/forem/posts_controller.rb