diff --git a/lib/costs_issue_observer.rb b/lib/costs_issue_observer.rb index 656abdd6d0..4ae08bbed4 100644 --- a/lib/costs_issue_observer.rb +++ b/lib/costs_issue_observer.rb @@ -6,5 +6,12 @@ class CostsIssueObserver < ActiveRecord::Observer CostEntry.update_all({:project_id => issue.project_id}, {:issue_id => id}) end end + + def before_update(issue) + # FIXME: remove this method once controller_issues_move_before_save is in 0.9-stable + if issue.project_id_changed? && issue.cost_object_id && !issue.project.cost_object_ids.include?(issue.cost_object_id) + issue.cost_object = nil + end + end end \ No newline at end of file