diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index be6543be2..14c2f3a11 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -296,7 +296,7 @@ class ForumsController < ApplicationController #检查forum的名字 def check_forum_name - forum_name_exist = Forum.where("name = '#{params[:forum_name]}'").count >= 1 ? true : false + forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false render :text => forum_name_exist end diff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erb index 24130e727..ef1fbc12b 100644 --- a/app/views/forums/edit.html.erb +++ b/app/views/forums/edit.html.erb @@ -43,13 +43,10 @@ function check_forum_name(){ check_pass = true; name = $("textarea[name='forum[name]']").val().trim(); - if(name == '<%= @forum.name%>'){ - return; - } if( name != ""){ $.get( '<%= check_forum_name_forums_path %>', - {"forum_name":name}, + {"forum_name":name,"forum_id":<%= @forum.id%>}, function(data){ if( data == 'true'){