What is the best way to solve the problem? User inputs and edits string ‘tom had a dog’. I’d like the model and database to store ‘tom’ and ‘had a dog’ as separate fields. I recall solving this problem when dealing with telephone number strings but can’t quite recall how I did.
Share
You could create a setter in your model that isn’t mapped to a database field… this setter would contain the logic that determines how the string is split in two, then sets the two fields accordingly: