HowTo: Custom Field in Lift-Record-Squeryl

you are implementing your validation logic incorrectly. The correct way to validate a Record field is to override

def validations: List[ValidationFunction]

where ValidationFunction is a type alias

type ValidationFunction = ValueType => List[FieldError]

and in your case ValueType == String.

The next issue is your Domain trait. Because your call to validate is inlined into the class definition, it will be called when your field is constructed.

Leave a Comment