Skip to content

Instantly share code, notes, and snippets.

@baileylo
Created October 19, 2010 08:41
Show Gist options
  • Save baileylo/633853 to your computer and use it in GitHub Desktop.
Save baileylo/633853 to your computer and use it in GitHub Desktop.
New functions for conversation controller
# GET /conversations/new
def new
@conversation = Conversation.new
@comment = @conversation.comments.build
respond_to do |format|
format.html # new.html.erb
end
end
# POST /conversations
def create
@conversation = Conversation.new(params[:conversation])
@comment = @conversation.comments.build(params[:comment])
@conversation.user_id = @comment.user_id = current_user.id
@conversation.board = @board
respond_to do |format|
if current_user && @conversation.save
format.html { redirect_to(board_path(@board), :notice => 'Your Post was created') }
else
format.html { render :action => "new" }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment