Class: PersonalBlog::CommentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- PersonalBlog::CommentsController
- Defined in:
- app/controllers/personal_blog/comments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/personal_blog/comments_controller.rb', line 5 def create @post = Post.find(params[:post_id]) @comment = @post.comments.create(comment_params) if @comment.valid? flash[:notice] = "Comment has been created!" redirect_to post_path(@post) else flash[:error] = "Comment must have some content." redirect_to post_path(@post) end end |