On Thu, Sep 17, 2009 at 9:14 AM, Marnen Laibow-Koser
<rails-mailing-l...@andreas-s.net> wrote:
>
> Patrick Doyle wrote:
>> Suppose one had a hypothetical situation in which records were entered
>> into a database which were later determined to be invalid.
>
> Because they were invalid in the first place, or because the criteria
> for validity changed?
Probably a little of both.  Regardless, now there could potentially be
a problem in the database.

>
>>
>> In this supposedly hypothetical situation, the agile programmer might
>> add validations to the models to ensure this doesn't, err, wouldn't happen
>> again.
>
> Yes.  And also constraints in the database.
That's a new one for me... I presume there are ways to implement the
same sort of validates_presence_of and validates_uniqueness_of checks
in databaseland, but what about custom validations that require, for
example, text be formatted a certain way, or a product price must be
at least a cent, etc...

I guess I'm asking what is the value added to constraints in a
database that will only ever be accessed via the web application
front-end?

>>
>> One thing I've thought of would be to write a throwaway rake task
>
> This seems quite reasonable.  If it's a question of the data structure
> changing and affecting validity, then it's probably a good idea to put
> the validation routine right in the migration file.
In this (um, hypothetical) case, there is no migration file.  It's
just been noticed after the fact that there is something wrong.

Fortunately, this is hypothetically a very small, custom application
that is only used (currently) by a single user, so the effects are not
terribly disastrous.

--wpd

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to