首页更多报错

This commit is contained in:
yanxd 2014-07-04 14:43:57 +08:00
parent b6ebbab830
commit 8ccc39ae71
1 changed files with 2 additions and 4 deletions

View File

@ -281,12 +281,11 @@ class CoursesController < ApplicationController
if @school_id == "0" or @school_id.nil? if @school_id == "0" or @school_id.nil?
@courses_all = Course.active.visible. @courses_all = Course.active.visible.
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id"). joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id").
where("#{Course.table_name}.course_type = ? ", Course::CourseType_course)
else else
@courses_all = Course.active.visible. @courses_all = Course.active.visible.
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id"). joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id").
joins(:course_extra). joins(:course_extra).
where("#{Course.table_name}.course_type = ? AND #{Course.table_name}.school_id = ?", Course::CourseType_course, @school_id) where("#{Course.table_name}.school_id = ?", @school_id)
end end
@course_count = @courses_all.count @course_count = @courses_all.count
@ -407,8 +406,7 @@ class CoursesController < ApplicationController
else else
@courses_all = Course.active.visible. @courses_all = Course.active.visible.
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id"). joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id").
joins(:course_extra). where("#{Course.table_name}.school_id = ?", @school_id)
where("#{Course.table_name}.course_type = ? AND #{Course.table_name}.school_id = ?", Course::CourseType_course, @school_id)
end end
@course_count = @courses_all.count @course_count = @courses_all.count