From 3ceee6522b9b3320f33e4765b4a787eb54b11a1e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 14 Oct 2016 21:05:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E6=96=B0=E5=BB=BA=E8=B4=B4?= =?UTF-8?q?=E5=90=A7=E6=8A=A5=E8=B4=B4=E5=90=A7=E5=90=8D=E5=B7=B2=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/forums_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 6ebe6b9eb..3332f1207 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -296,12 +296,12 @@ class ForumsController < ApplicationController #检查forum的名字 def check_forum_name - forum_name_exist = false - # if params[:forum_id] - # forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false - # else + forum_name_exist = true + if params[:forum_id] + forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false + else forum_name_exist = Forum.where("name = '#{params[:forum_name]}' ").count >= 1 ? true : false - # end + end render :text => forum_name_exist end