validates_length_of :password, :maximum => 255, :allow_nil => true
# Checks if the SCM is enabled when creating a repository
- validate_on_create { |r| r.errors.add(:type, :invalid) unless Setting.enabled_scm.include?(r.class.name.demodulize) }
+ validate :repo_create_validation, :on => :create
+
+ def repo_create_validation
+ unless Setting.enabled_scm.include?(self.class.name.demodulize)
+ errors.add(:type, :invalid)
+ end
+ end
def self.human_attribute_name(attribute_key_name)
attr_name = attribute_key_name