From 0363ad5cd7533f6b2b3fd6d66d8c7f900d9361eb Mon Sep 17 00:00:00 2001 From: "Timothy N. Tsvetkov" Date: Thu, 10 Mar 2011 13:45:38 +0300 Subject: [PATCH] minor: reogranized a bit code in platform model --- app/models/platform.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/models/platform.rb b/app/models/platform.rb index 547ba312c..90bd5d1bf 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -1,12 +1,13 @@ class Platform < ActiveRecord::Base - validate :name, :presence => true, :uniqueness => true - validate :unixname, :presence => true, :uniqueness => true - before_validation :generate_unixname - validate :validate_unixname - has_many :projects, :dependent => :destroy has_one :parent, :class_name => 'Platform', :foreign_key => 'parent_platform_id' + validate :name, :presence => true, :uniqueness => true + validate :unixname, :presence => true, :uniqueness => true + validate :validate_unixname + + before_validation :generate_unixname + protected def generate_unixname