Mercurial > hg > soundsoftware-site
diff app/models/.svn/text-base/issue_status.rb.svn-base @ 1:cca12e1c1fd4
* Update to Redmine trunk (SVN revisions 3860-3892)
author | Chris Cannam |
---|---|
date | Wed, 28 Jul 2010 12:08:28 +0100 |
parents | 513646585e45 |
children | 8661b858af72 |
line wrap: on
line diff
--- a/app/models/.svn/text-base/issue_status.rb.svn-base Fri Jul 23 15:52:44 2010 +0100 +++ b/app/models/.svn/text-base/issue_status.rb.svn-base Wed Jul 28 12:08:28 2010 +0100 @@ -17,8 +17,10 @@ class IssueStatus < ActiveRecord::Base before_destroy :check_integrity - has_many :workflows, :foreign_key => "old_status_id", :dependent => :delete_all + has_many :workflows, :foreign_key => "old_status_id" acts_as_list + + before_destroy :delete_workflows validates_presence_of :name validates_uniqueness_of :name @@ -89,4 +91,9 @@ def check_integrity raise "Can't delete status" if Issue.find(:first, :conditions => ["status_id=?", self.id]) end + + # Deletes associated workflows + def delete_workflows + Workflow.delete_all(["old_status_id = :id OR new_status_id = :id", {:id => id}]) + end end