summaryrefslogtreecommitdiffstats
path: root/app/models/issue_status.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-05-31 17:19:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-05-31 17:19:01 +0000
commit4dddb606a6d24c7f95e52f08e689464ab6f8b5b8 (patch)
tree79c27e39cf5a2488e1667388734eacee3f045bee /app/models/issue_status.rb
parent22c7419a70157991fff9e8a5c8ccfdb6ac788343 (diff)
downloadredmine-4dddb606a6d24c7f95e52f08e689464ab6f8b5b8.tar.gz
redmine-4dddb606a6d24c7f95e52f08e689464ab6f8b5b8.zip
Added :dependent => :delete_all on IssueStatus Workflow association.
Also added compact in find_new_statuses_allowed_to to remove nil statuses. git-svn-id: http://redmine.rubyforge.org/svn/trunk@558 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_status.rb')
-rw-r--r--app/models/issue_status.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/issue_status.rb b/app/models/issue_status.rb
index cea77132e..beb06f140 100644
--- a/app/models/issue_status.rb
+++ b/app/models/issue_status.rb
@@ -17,7 +17,7 @@
class IssueStatus < ActiveRecord::Base
before_destroy :check_integrity
- has_many :workflows, :foreign_key => "old_status_id"
+ has_many :workflows, :foreign_key => "old_status_id", :dependent => :delete_all
acts_as_list
validates_presence_of :name
@@ -47,7 +47,7 @@ class IssueStatus < ActiveRecord::Base
def find_new_statuses_allowed_to(role, tracker)
new_statuses = workflows.find(:all,
:include => :new_status,
- :conditions => ["role_id=? and tracker_id=?", role.id, tracker.id]).collect{ |w| w.new_status } if role && tracker
+ :conditions => ["role_id=? and tracker_id=?", role.id, tracker.id]).collect{ |w| w.new_status }.compact if role && tracker
new_statuses ? new_statuses.sort{|x, y| x.position <=> y.position } : []
end