One of the things that strikes me as odd about the validations as I
understand them to work from AWDWR, is that the validations
themselves are only triggered upon a save.
I brought this up earlier that I am accustomed to doing validations
of data before updating a model with it, but Rails wants to allow the
modification of the model, then only bother to validate it if it is
saved – at least that’s what I’m seeing at this point.
What good does that do unsaved model data? Model data that perhaps
never gets saved to a database, but nonetheless must have validated
data to perform its interim purpose.
What if I bring data in from a web service or a file – isn’t it best
to complain to that source (or log the problem, or whatever) at the
moment the data is accepted, and not some who-knows-when point which
may be tainted by some other process and therefore I lose the ability
to complain to the actual source that provided the bad data?
Looking at the methods in validations.rb, I’m not seeing a method
that gives me arbitrary control over when to invoke validations.
I’m probably still not seeing the whole picture, but I’m getting that
“something’s wrong” feeling.
– gw (www.railsdev.ws)