summaryrefslogtreecommitdiffstats
path: root/redmine/app/models/version.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2006-06-28 18:11:03 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2006-06-28 18:11:03 +0000
commit6b7650e2f03156ea1e3985b30c1995e44c317e3d (patch)
treee56734d45ecc3725b77f3da1ede21294e49ec894 /redmine/app/models/version.rb
parent73e0b8f8b3c9350018a7d8fda143dd9b8aa6f091 (diff)
downloadredmine-6b7650e2f03156ea1e3985b30c1995e44c317e3d.tar.gz
redmine-6b7650e2f03156ea1e3985b30c1995e44c317e3d.zip
Initial commit
git-svn-id: http://redmine.rubyforge.org/svn/trunk@4 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'redmine/app/models/version.rb')
-rw-r--r--redmine/app/models/version.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/redmine/app/models/version.rb b/redmine/app/models/version.rb
new file mode 100644
index 000000000..02dee15c8
--- /dev/null
+++ b/redmine/app/models/version.rb
@@ -0,0 +1,30 @@
+# redMine - project management software
+# Copyright (C) 2006 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 Version < ActiveRecord::Base
+ before_destroy :check_integrity
+ belongs_to :project
+ has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id'
+ has_many :attachments, :as => :container, :dependent => true
+
+ validates_presence_of :name, :descr
+
+private
+ def check_integrity
+ raise "Can't delete version" if self.fixed_issues.find(:first)
+ end
+end