Fix repository validation. Fix platform callbacks.

This commit is contained in:
konstantin.grabar 2011-10-28 01:24:38 +04:00
parent 27e51aa1b5
commit 61816bd557
2 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ class Platform < ActiveRecord::Base
after_create :make_owner_rel
# before_save :create_directory
before_save :make_owner_rel
after_destroy :remove_directory
# after_destroy :remove_directory
before_create :xml_rpc_create
before_destroy :xml_rpc_destroy
# before_update :check_freezing

View File

@ -15,8 +15,8 @@ class Repository < ActiveRecord::Base
has_many :members, :through => :objects, :source => :object, :source_type => 'User'
has_many :groups, :through => :objects, :source => :object, :source_type => 'Group'
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true
validates :unixname, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true, :format => { :with => /^[a-zA-Z0-9\-.]+$/ }
validates :name, :uniqueness => {:scope => :platform_id}, :presence => true
validates :unixname, :uniqueness => {:scope => :platform_id}, :presence => true, :format => { :with => /^[a-zA-Z0-9\-.]+$/ }
validates :platform_id, :presence => true
scope :recent, order("name ASC")