From 9f7cdba5e642faa17cb556f2b7882d7dd5adab0c Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 28 Mar 2012 14:01:13 +0200 Subject: [PATCH] Add activerecord model for AUTHORS --- .../main/webapp/WEB-INF/app/models/author.rb | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 sonar-server/src/main/webapp/WEB-INF/app/models/author.rb diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/author.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/author.rb new file mode 100644 index 00000000000..ee0d86efc03 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/author.rb @@ -0,0 +1,31 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2012 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# Sonar 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# +class Author < ActiveRecord::Base + + belongs_to :person, :class_name => 'Project', :foreign_key => 'person_id' + + validates_uniqueness_of :login + validates_presence_of :person + validates_length_of :login, :allow_blank => false, :maximum => 100 + + def <=>(other) + login<=>other.login + end +end \ No newline at end of file -- 2.39.5