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/member_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/member_role.rb')
-rw-r--r-- | app/models/member_role.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/models/member_role.rb b/app/models/member_role.rb new file mode 100644 index 000000000..46777cd1e --- /dev/null +++ b/app/models/member_role.rb @@ -0,0 +1,27 @@ +# Redmine - project management software +# Copyright (C) 2006-2009 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class MemberRole < ActiveRecord::Base + belongs_to :member + belongs_to :role + + validates_presence_of :role + + def validate + errors.add :role_id, :invalid if role && !role.member? + end +end |