课程里搜东西 没有内容项目里也跳出来的问题

This commit is contained in:
yanxd 2014-04-11 16:43:05 +08:00
parent 3e1a674ed9
commit 96fcdbacf2
1 changed files with 4 additions and 2 deletions

View File

@ -218,8 +218,10 @@ class ProjectsController < ApplicationController
def search
#modified by nie
@projects = Project.visible
@projects = @projects.visible.where('project_type = ?', params[:project_type]).like(params[:name]) if params[:name].present?
project_type = params[:project_type]
projects_all = (project_type.eql? Project::ProjectType_project) ? Project.project_entities : Project.course_entities
@projects = projects_all.visible
@projects = @projects.visible.like(params[:name]) if params[:name].present?
@offset, @limit = api_offset_and_limit({:limit => 10})
@project_count = @projects.visible.count
@project_pages = Paginator.new @project_count, @limit, params['page']