comparison app/controllers/projects_controller.rb @ 418:a9921f3e9088 bug_133

Use all with ordering instead of sort_by for projects (fixes #133)
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Tue, 10 May 2011 11:39:27 +0100
parents ebf53b46f3f3
children 350acce374a2
comparison
equal deleted inserted replaced
415:405dd646a6cc 418:a9921f3e9088
57 @project_count = Project.visible_roots.count 57 @project_count = Project.visible_roots.count
58 @project_pages = Paginator.new self, @project_count, @limit, params['page'] 58 @project_pages = Paginator.new self, @project_count, @limit, params['page']
59 @offset ||= @project_pages.current.offset 59 @offset ||= @project_pages.current.offset
60 @projects = Project.visible_roots.all(:offset => @offset, :limit => @limit, :order => sort_clause) 60 @projects = Project.visible_roots.all(:offset => @offset, :limit => @limit, :order => sort_clause)
61 if User.current.logged? 61 if User.current.logged?
62 @user_projects = User.current.projects.sort_by(&:name) 62 # seems sort_by gives us case-sensitive ordering, which we don't want
63 # @user_projects = User.current.projects.sort_by(&:name)
64 @user_projects = User.current.projects.all(:order => :name)
63 end 65 end
64 render :template => 'projects/index.rhtml', :layout => !request.xhr? 66 render :template => 'projects/index.rhtml', :layout => !request.xhr?
65 } 67 }
66 format.xml { 68 format.xml {
67 @projects = Project.visible.find(:all, :order => 'lft') 69 @projects = Project.visible.find(:all, :order => 'lft')