summaryrefslogtreecommitdiffstats
path: root/app/models/tracker.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-25 20:18:55 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-25 20:18:55 +0000
commit59cbc68dde9cda2178e9194746f60a2161d973bf (patch)
tree55e321ea1efceaa744546b0571ce7d9f93c70487 /app/models/tracker.rb
parent221585c7b5708659e9059b6119846948b07570bb (diff)
downloadredmine-59cbc68dde9cda2178e9194746f60a2161d973bf.tar.gz
redmine-59cbc68dde9cda2178e9194746f60a2161d973bf.zip
Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9714 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/tracker.rb')
-rw-r--r--app/models/tracker.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/models/tracker.rb b/app/models/tracker.rb
index d489d6d45..ce34f782c 100644
--- a/app/models/tracker.rb
+++ b/app/models/tracker.rb
@@ -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