Michael Koziarski wrote: >> Rails is wrong in asserting that 0000-00-00 is poor database design, and >> Rails is wrong to prevent the value from being used. > > Your approach is wrong in attempting to generate discussion. Your > attempt to make your point clear is wrong in that I don't follow what > it is you're trying to achieve. > > I'm not sure what problem you've hit, what solution you propose, or > how you want to implement it, but I do know you think rails is wrong?
Yeah, you're right, I Ieft too many "Rails is wrong" in there. I wrote each one planning for that to be the one after I got done editing, and I got interrupted and sent the message thinking I was done. It reads flamey for sure. My appologies. Anyway... If a (MySQL) database table declares a datetime field as NOT NULL with a default value of 0000-00-00 00:00:00 and an empty value is submitted to that field via Rails, Rails complains that the field cannot be null. If a string literal of 0000-00-00 00:00:00 is submitted, Rails coerces the value to nil, and once again complains about not null. I tracked down some bug reports and other posts, and it appears that the Rails core position is that using 0000-00-00 is poor data design, and it is Rails' duty to not allow it to be used, further taking the position that that's what NULL is for. Well, NULL is for that third alternative. As it stands, Rails allows only two states for dates. A valid date or NULL. There are occassions, rare as they may be, to interpret date data in three ways just like numerics or strings. -- 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 -~----------~----~----~----~------~----~------~--~---
