Open tanapoln opened 9 years ago
You can just override the initializer and do the logic there.
I don't think that the behaviour when model raises exception when you are trying to get an instance of it is useful. Sounds like anti-pattern. Instead of that you should probably define some method named valid?
to check if model is valid or not and then manually raise an exception.
Sorry for necroposting, but it is default behavior in ActiveRecord and can really save you from typos in you code. I think optional mode with restricted unknown fields is a good idea.
For example,