summaryrefslogtreecommitdiffstats
path: root/app/models/repository.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 1ea77f24f..e6ed7da52 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -19,7 +19,10 @@ class Repository < ActiveRecord::Base
belongs_to :project
has_many :changesets, :dependent => :destroy, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
has_many :changes, :through => :changesets
-
+
+ # Checks if the SCM is enabled when creating a repository
+ validate_on_create { |r| r.errors.add(:type, :activerecord_error_invalid) unless Setting.enabled_scm.include?(r.class.name.demodulize) }
+
# Removes leading and trailing whitespace
def url=(arg)
write_attribute(:url, arg ? arg.to_s.strip : nil)