##// END OF EJS Templates
Added :dependent => :delete_all on IssueStatus Workflow association....
Jean-Philippe Lang -
r555:4dddb606a6d2
parent child
Show More
@@ -17,7 +17,7
17
17
18 class IssueStatus < ActiveRecord::Base
18 class IssueStatus < ActiveRecord::Base
19 before_destroy :check_integrity
19 before_destroy :check_integrity
20 has_many :workflows, :foreign_key => "old_status_id"
20 has_many :workflows, :foreign_key => "old_status_id", :dependent => :delete_all
21 acts_as_list
21 acts_as_list
22
22
23 validates_presence_of :name
23 validates_presence_of :name
@@ -47,7 +47,7 class IssueStatus < ActiveRecord::Base
47 def find_new_statuses_allowed_to(role, tracker)
47 def find_new_statuses_allowed_to(role, tracker)
48 new_statuses = workflows.find(:all,
48 new_statuses = workflows.find(:all,
49 :include => :new_status,
49 :include => :new_status,
50 :conditions => ["role_id=? and tracker_id=?", role.id, tracker.id]).collect{ |w| w.new_status } if role && tracker
50 :conditions => ["role_id=? and tracker_id=?", role.id, tracker.id]).collect{ |w| w.new_status }.compact if role && tracker
51 new_statuses ? new_statuses.sort{|x, y| x.position <=> y.position } : []
51 new_statuses ? new_statuses.sort{|x, y| x.position <=> y.position } : []
52 end
52 end
53
53
General Comments 0
You need to be logged in to leave comments. Login now