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
This commit is contained in:
Toshi MARUYAMA 2011-12-03 16:41:23 +00:00
parent 7a5d6f61c7
commit 997995397e
1 changed files with 2 additions and 1 deletions

View File

@ -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]