Refactor: Extract method to the Member model

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3601 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2010-03-18 15:49:11 +00:00
parent f741ca7269
commit b5d9a1dfbd
3 changed files with 9 additions and 4 deletions
+7
View File
@@ -71,6 +71,13 @@ class Member < ActiveRecord::Base
IssueCategory.update_all "assigned_to_id = NULL", ["project_id = ? AND assigned_to_id = ?", project.id, user.id]
end
end
# Find or initilize a Member with an id, attributes, and for a Principal
def self.edit_membership(id, new_attributes, principal=nil)
@membership = id.present? ? Member.find(id) : Member.new(:principal => principal)
@membership.attributes = new_attributes
@membership
end
protected