Guest User

Untitled

a guest
Jun 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. # GET /conversations/reply
  2. def reply
  3. @conversation = Conversation.find(params[:id])
  4. @comment = @conversation.comments.build
  5.  
  6. respond_to do |format|
  7. format.html #reply.html.erb
  8. end
  9. end
  10.  
  11. # POST /conversations/reply
  12. def save_reply
  13. if !current_user
  14. redirect_to(:login, :notice =>"Please login before posting")
  15. return 1;
  16. end
  17.  
  18. if Conversation.exists?(params[:id])
  19. @conversation = Conversation.find(params[:id])
  20. @comment = @conversation.comments.build(params[:comment])
  21. @comment.user_id = current_user.id
  22. else
  23. redirect_to(boards_path, :notice =>"Please specify a valid board")
  24. end
  25.  
  26. respond_to do |format|
  27. if current_user && @comment.save
  28. format.html { redirect_to(board_path(@board), :notice => 'Your reply was posted') }
  29. else
  30. format.html { render :action => "new" }
  31. end
  32. end
  33. end
Add Comment
Please, Sign In to add comment