improves consistency of error messages [#110]

This commit is contained in:
rgarcia
2015-08-16 15:49:07 +02:00
parent e4406e5916
commit a81612b226
26 changed files with 222 additions and 166 deletions

View File

@@ -1,17 +1,19 @@
class CommentsController < ApplicationController
before_action :authenticate_user!
before_action :build_comment, only: :create
before_action :parent, only: :create
load_and_authorize_resource
respond_to :html, :js
def create
@comment.save!
@comment.move_to_child_of(parent) if reply?
if @comment.save
@comment.move_to_child_of(parent) if reply?
Mailer.comment(@comment).deliver_now if email_on_debate_comment?
Mailer.reply(@comment).deliver_now if email_on_comment_reply?
respond_with @comment
Mailer.comment(@comment).deliver_now if email_on_debate_comment?
Mailer.reply(@comment).deliver_now if email_on_comment_reply?
else
render :new
end
end
def vote