validations.rb revision 7f12123144c64e1114c5fc62158230fa96706746
included do
uniqueness: { case_sensitive: false },
if: :name_changed?
uniqueness: { case_sensitive: true },
if: :path_changed?
validates :remote_type, presence: true, if: :source_address?
presence: true,
inclusion: {in: Repository::Access::OPTIONS}
end
if record.mirror? && (record.private_rw? || record.public_rw?)
record.errors[:access] =
'Error! Write access is not allowed for a mirrored repositry.'
end
end
end
end
# toplevel namespaces in routing are reserved words
end
end
end
end
end
end
end
# It is against our code style conventions to place a constant here,
# but it is necessary to have all the inherent methods defined above of it.
end
record.errors[:name] = 'we do not allow renaming, right now'
end
end
end
end
end
end
"Source address not set for #{record.remote_type}"
"Source type not set for #{record.remote_type}"
end
end
end
if record.mirror? && !record.source_type.present?
"(types supported: #{Repository::Importing::SOURCE_TYPES.join(', ')})"
record.errors[:source_type] = 'not present'
end
end
end
end