Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9714 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -121,7 +121,7 @@ class Project < ActiveRecord::Base
|
||||
self.enabled_module_names = Setting.default_projects_modules
|
||||
end
|
||||
if !initialized.key?('trackers') && !initialized.key?('tracker_ids')
|
||||
self.trackers = Tracker.all
|
||||
self.trackers = Tracker.sorted.all
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ class Tracker < ActiveRecord::Base
|
||||
validates_uniqueness_of :name
|
||||
validates_length_of :name, :maximum => 30
|
||||
|
||||
scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}}
|
||||
scope :sorted, order("#{table_name}.position ASC")
|
||||
scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
|
||||
|
||||
def to_s; name end
|
||||
|
||||
@@ -40,10 +41,6 @@ class Tracker < ActiveRecord::Base
|
||||
position <=> tracker.position
|
||||
end
|
||||
|
||||
def self.all
|
||||
find(:all, :order => 'position')
|
||||
end
|
||||
|
||||
# Returns an array of IssueStatus that are used
|
||||
# in the tracker's workflows
|
||||
def issue_statuses
|
||||
@@ -63,6 +60,6 @@ class Tracker < ActiveRecord::Base
|
||||
|
||||
private
|
||||
def check_integrity
|
||||
raise "Can't delete tracker" if Issue.find(:first, :conditions => ["tracker_id=?", self.id])
|
||||
raise Exception.new("Can't delete tracker") if Issue.where(:tracker_id => self.id).any?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ class Workflow < ActiveRecord::Base
|
||||
target_trackers = [target_trackers].flatten.compact
|
||||
target_roles = [target_roles].flatten.compact
|
||||
|
||||
target_trackers = Tracker.all if target_trackers.empty?
|
||||
target_trackers = Tracker.sorted.all if target_trackers.empty?
|
||||
target_roles = Role.all if target_roles.empty?
|
||||
|
||||
target_trackers.each do |target_tracker|
|
||||
|
||||
Reference in New Issue
Block a user