Sha256: 0f2bf5803e3038ee8f744be3bc665d2a85bbc4c6bd82b47b037c4886a5fbef46

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

# 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 UserRole < ActiveRecord::Base
  belongs_to :user
  belongs_to :role

  validates_presence_of :role
  validates_presence_of :user

  validates_uniqueness_of :user_id, :scope => :role_id, :message => "has this role already"

  def inherited?
    !inherited_from.nil?
  end

  private
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/models/user_role.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/models/user_role.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/models/user_role.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/models/user_role.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/models/user_role.rb