Magritte pre-validation hooks?
2007-06-01 17:48:49 GMT
Is there an easy way in Magritte to clean up user-supplied data before validation? I'm doing something like this: > Address>>state: aString > state := aString ifNotNil: [:s | s trimBlanks] > > Address class>>descriptionState > ^(MAStringDescription auto: 'state' label: 'State') > addCondition: [:value | value trimBlanks size = 2] labelled: > 'Please enter a two-character abbreviation'; > yourself In Rails, ActiveRecord offers a before_validation hook for this kind of cleanup. I have mostly used it to coerce empty strings to nil, but it looks like Magritte's default string reader at least does that part for me. Should I implement my own StringReader to accomplish this in one place? -- Ken Treis Miriam Technologies, Inc. _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki