enable_module表被还原问题,原因课程新建失败时,@course对象未保存故其id为null,却做了删除操作级联删除enable_module表时sql语句就成了DELETE FROM `enabled_modules` WHERE `enabled_modules`.`course_id` IS NULL 而这刚好对应了所有项目数据。解决办法:去掉删除课程语句,未保存成功时不需删除

This commit is contained in:
z9hang 2014-09-23 14:46:19 +08:00
parent 086d99fe2a
commit 97156f0de1
1 changed files with 1 additions and 1 deletions

View File

@ -269,7 +269,7 @@ class CoursesController < ApplicationController
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
end
else
@course.destroy
#@course.destroy
respond_to do |format|
format.html { render :action => 'new', :layout => 'base' } #Added by young
format.api { render_validation_errors(@course) }