版本库标识限定为全局唯一

This commit is contained in:
nwb 2014-08-28 14:35:42 +08:00
parent bdeb2e5947
commit 51b21000a7
1 changed files with 2 additions and 1 deletions

View File

@ -39,7 +39,8 @@ class Repository < ActiveRecord::Base
validates_length_of :password, :maximum => 255, :allow_nil => true validates_length_of :password, :maximum => 255, :allow_nil => true
validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true #validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_uniqueness_of :identifier, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes, underscores but not digits only # donwcase letters, digits, dashes, underscores but not digits only
validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true