Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class CommentsController < ApplicationController
  2.  
  3. def new
  4. @job_task = JobTask.find params[:job_task_id]
  5. @comment = Comment.new
  6. end
  7.  
  8. def create
  9. @job_task = JobTask.find params[:job_task_id]
  10. @comment = Comment.new(comment_params)
  11. @comment.user = current_user
  12. if @comment.save
  13. return redirect_to new_job_task_comment_url(@job)
  14. end
  15.  
  16. end
  17.  
  18. private
  19. def comment_params
  20. params.require(:comment).permit(:comment)
  21. end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement