diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index d3481e2a..5c9fa7fc 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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']