class Forum::ForumMessagesController < ApplicationController
  layout "forum"
  
  before_filter :auth_fuser
  


  def show
    @message = ForumMessage.find(params[:id])

  end


  def new
    @message = ForumMessage.new(:forum_topic_id => params[:topic_id])
  
  end

  def edit
    @message = ForumMessage.find(params[:id])
  
  end

  def create
  	@message = ForumMessage.new(params[:forum_message])
    @message.forum_user = current_fuser
    if @message.save
      
      redirect_to forum_forum_topic_path(@message.forum_topic_id)
          
  	else
  		render :action => "new" 
  	end
  end

  def update

  	@message = ForumMessage.find(params[:id])
    
    if @message.update_attributes(params[:forum_message])
      redirect_to forum_forum_topic_path(@message.forum_topic_id)
          
  	else
  		render :action => "edit" 
  	end
    
  end
  		


  def destroy
  	@message = ForumMessage.find(params[:id])
	  @message.destroy
    redirect_to forum_forum_topic_path(@message.forum_topic_id)

  end



end
