修正项目列表界面搜索空值报错问题

This commit is contained in:
z9hang 2014-05-14 15:22:08 +08:00
parent 77b5ce658b
commit 5649cc545e
1 changed files with 6 additions and 2 deletions

View File

@ -295,8 +295,12 @@ class ProjectsController < ApplicationController
project_type = params[:project_type].to_i
projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities
@projects = projects_all.visible
@projects_all = @projects.visible.like(params[:name]) if params[:name].present?
#@projects_all = @projects.visible.like(params[:name]) if params[:name].present?
if params[:name].present?
@projects_all = @projects.visible.like(params[:name])
else
@projects_all = @projects;
end
@project_count = @projects_all.count
@project_pages = Paginator.new @project_count, per_page_option, params['page']