Class: Blog::CommentsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/blog/comments_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/blog/comments_controller.rb', line 6

def create
  @comment.save!
  
  flash[:success] = 'Comment created'
  redirect_to blog_post_path(@cms_site.path, @blog.path, @post.slug)
  
rescue ActiveRecord::RecordInvalid
  flash[:error] = 'Failed to create Comment'
  render 'blog/posts/show'
end