From 997995397e503d365a663ef53d800ac8da1ef962 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 3 Dec 2011 16:41:23 +0000 Subject: [PATCH] Rails3: model: replace deprecated before_destroy method at member model git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8058 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/member.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/member.rb b/app/models/member.rb index 4206ba446..f54981867 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -26,6 +26,7 @@ class Member < ActiveRecord::Base validates_uniqueness_of :user_id, :scope => :project_id validate :validate_role + before_destroy :set_issue_category_nil after_destroy :unwatch_from_permission_change def name @@ -66,7 +67,7 @@ class Member < ActiveRecord::Base end end - def before_destroy + def set_issue_category_nil if user # remove category based auto assignments for this member IssueCategory.update_all "assigned_to_id = NULL", ["project_id = ? AND assigned_to_id = ?", project.id, user.id]