diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-05-10 10:54:31 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-05-10 10:54:31 +0000 |
commit | 7dccf9fda6f30d8f4b0c5eaad9f6e2a1e67cd643 (patch) | |
tree | ba6a18abff6ca69af528b3d295263d049a22266f /app/models/role.rb | |
parent | 814e138c2a1105f8d9d10c4362a889dd71aff32d (diff) | |
download | redmine-7dccf9fda6f30d8f4b0c5eaad9f6e2a1e67cd643.tar.gz redmine-7dccf9fda6f30d8f4b0c5eaad9f6e2a1e67cd643.zip |
Allows multiple roles on the same project (#706). Prerequisite for user groups feature.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2726 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/role.rb')
-rw-r--r-- | app/models/role.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/role.rb b/app/models/role.rb index b07e7a039..a93c4eaca 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -38,7 +38,8 @@ class Role < ActiveRecord::Base end end - has_many :members + has_many :member_roles, :dependent => :destroy + has_many :members, :through => :member_roles acts_as_list serialize :permissions, Array @@ -82,7 +83,11 @@ class Role < ActiveRecord::Base end def <=>(role) - position <=> role.position + role ? position <=> role.position : -1 + end + + def to_s + name end # Return true if the role is a builtin role |