add info mail for new blog comments

This commit is contained in:
jomo
2014-05-03 03:33:09 +02:00
parent 4130216e11
commit e0b1540593
6 changed files with 51 additions and 33 deletions

View File

@@ -1,5 +1,7 @@
class CommentsController < ApplicationController
include MailerHelper
def edit
@comment = Comment.find(params[:id])
if mod? || @comment.author.is?(current_user)
@@ -15,6 +17,7 @@ class CommentsController < ApplicationController
@comment.user_author = current_user
@comment.blogpost = Blogpost.find(params[:blogpost_id])
if @comment.save
@comment.send_new_comment_mail
redirect_to blogpost_path(@comment.blogpost) + "#comment-#{@comment.id}", notice: 'Comment created!'
else
flash[:alert] = "Could not create comment."