Created
October 19, 2010 08:41
-
-
Save baileylo/633853 to your computer and use it in GitHub Desktop.
New functions for conversation controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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