Guest User

Untitled

a guest
Jun 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. # GET /conversations/new
  2. def new
  3. @conversation = Conversation.new
  4. @comment = @conversation.comments.build
  5.  
  6. respond_to do |format|
  7. format.html # new.html.erb
  8. end
  9. end
  10.  
  11. # POST /conversations
  12. def create
  13. @conversation = Conversation.new(params[:conversation])
  14. @comment = @conversation.comments.build(params[:comment])
  15. @conversation.user_id = @comment.user_id = current_user.id
  16. @conversation.board = @board
  17.  
  18. respond_to do |format|
  19. if current_user && @conversation.save
  20. format.html { redirect_to(board_path(@board), :notice => 'Your Post was created') }
  21. else
  22. format.html { render :action => "new" }
  23. end
  24. end
  25. end
Add Comment
Please, Sign In to add comment