From 01da0852e34b46cc90332670c25867cee91ce748 Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 5 Jul 2014 11:44:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=B4=B4=E5=90=A7=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/forums_controller.rb | 1 + app/views/forums/_form.html.erb | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 991af015..b54d98b8 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -129,6 +129,7 @@ class ForumsController < ApplicationController format.html { redirect_to @forum, notice: l(:label_forum_create_succ) } format.json { render json: @forum, status: :created, location: @forum } else + flash.now[:error] = "#{l :label_forum_create_fail}: #{@forum.errors.full_messages[0]}" format.html { render action: "new" } format.json { render json: @forum.errors, status: :unprocessable_entity } end diff --git a/app/views/forums/_form.html.erb b/app/views/forums/_form.html.erb index b14df7b1..f67aa118 100644 --- a/app/views/forums/_form.html.erb +++ b/app/views/forums/_form.html.erb @@ -3,15 +3,15 @@
<%= labelled_form_for(@forum) do |f| %> <% if @forum.errors.any? %> -
-

<%= pluralize(@forum.errors.count, "error") %> prohibited this forum from being saved:

+ <% end %>