Tim Connor wrote: > On Nov 24, 8:53 pm, Greg Willits <[EMAIL PROTECTED]> > wrote: >> A typical example would be a Date Due field where a valid date = when it >> was done, a NULL value = not done yet that we know of, and a 0000-00-00 >> value = it has been declared that it never will be done. Reports for >> this data must be able to distinguish between all three casees. > > Ugly Hax and total abuse of a magic value, imo. Use a flag, as per > Josh's post.
Just because I've seen it, doesn't mean it's "right" (and v.v.) but I've seen it often enough. Database providers allow the value as legal, so why shouldn't it be used? Nothing magic about it IMO. Most date parsing and validating code I've ever seen accepts it or uses it in some way (not that I've seen everything). It is logical and it avoids the need of exactly the type of field you're proposing (which of course is the typical alternative). >> Additionally, I have legacy data/logic being replicated in Rails that >> expects to find and handle 0000-00-00 date values a specific way. AFAICT >> I have no way to continue the legacy data/logic systems using Rails as I >> cannot populate a date field with 0000-00-00 to remain consistent with >> existing data. > > I don't think rails should be designed to play nicely with your > invalid legacy data, personally. Well, there's the difference I guess. I don't see it as an invalid date -- when databases allow/require it as the value in a non-null date field, I see it is as being valid as a "non-date" or "zero date." > Designing the framework around > individual cases of legacy usage is a very, very bad idea. Anyways, I > can imagine core members responses already, once they figure out what > you are asking: "Sounds like a great idea for a plug-in." ;) And if I can be pointed to how/where to override this behavior I would be happy -- I've started to dig into Rails internals, but just barely, and still trying to push my way through the multple layers of abstractions for things. I've downloaded the acts_as_monkey outline for plugins, but haven't experimented yet. -- gw -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
