validations.rb revision e6c44954655c89ba1d2a653055377e63b7f5a98d
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},
presence: true,
inclusion: {in: Repository::Access::OPTIONS_MIRROR},
if: :mirror?
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.remote? && !record.source_type.present?
'or not accessible '\
"(types supported: #{Repository::SOURCE_TYPES.join(', ')})"
record.errors[:source_type] = 'not present'
end
end
end
end