diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index c8222db73..56b62263c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -67,14 +67,14 @@ class ProjectsController < ApplicationController end def new - @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") + @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] end def create - @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") + @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] @@ -107,7 +107,7 @@ class ProjectsController < ApplicationController end def copy - @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") + @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all @source_project = Project.find(params[:id]) if request.get? @@ -165,7 +165,7 @@ class ProjectsController < ApplicationController end def settings - @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") + @issue_custom_fields = IssueCustomField.sorted.all @issue_category ||= IssueCategory.new @member ||= @project.members.new @trackers = Tracker.sorted.all diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 0238f8e19..c804d33bb 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -43,7 +43,7 @@ module RepositoriesHelper end def render_changeset_changes - changes = @changeset.filechanges.find(:all, :limit => 1000, :order => 'path').collect do |change| + changes = @changeset.filechanges.limit(1000).reorder('path').all.collect do |change| case change.action when 'A' # Detects moved/copied files diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb index 11a447660..1f70b9bfb 100644 --- a/app/helpers/timelog_helper.rb +++ b/app/helpers/timelog_helper.rb @@ -88,7 +88,7 @@ module TimelogHelper def entries_to_csv(entries) decimal_separator = l(:general_csv_decimal_separator) - custom_fields = TimeEntryCustomField.find(:all) + custom_fields = TimeEntryCustomField.all export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv| # csv header fields headers = [l(:field_spent_on), diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 22f29d3ac..08c66b57b 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -30,6 +30,8 @@ class CustomField < ActiveRecord::Base validate :validate_custom_field before_validation :set_searchable + scope :sorted, order("#{table_name}.position ASC") + CUSTOM_FIELDS_TABS = [ {:name => 'IssueCustomField', :partial => 'custom_fields/index', :label => :label_issue_plural},