Validations

From AardRock Wiki
Jump to: navigation, search

We need to validate user-input. One idea is to do it the Rails-way, that way, or model might look something like this:


class User {
   public boolean validate() {
      validatePresenceOf("name"); // a name is mandatory
      validateFormatOf("date", "\d\d\-\d\d\-\d\d\d\d"); // a date must follow this format
   }
}