Sha256: 19b3df22111ff2c0b44da13e6bfe3488032b6d63cb773509217afe150cff0654

Contents?: true

Size: 577 Bytes

Versions: 2

Compression:

Stored size: 577 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
neifelheim-forem-0.0.2 app/controllers/forem/posts_controller.rb
neifelheim-forem-0.0.1 app/controllers/forem/posts_controller.rb