Add validators for inst code and resource code
Brad mentioned we should probably add validators for the code fields for all models
Institution:
validates :code, format: { with: /\A[a-z0-9]{4}\z/,
message: "only allows 4 lowercase letters or numbers" }
Resource
validates :code, format: { with: /\A[a-z0-9]{4}(?::[a-z0-9_\-]+|-[a-z0-9]{4})?\z/,
message: "allows 4 lowercase letters or numbers with optional e.g., '-asc1' instcode or e.g., ':new_york_times' deeplink" }
Edited by Brad Baxter