Ok... lets bring it back around. Forget it says "boolean", for get all of the baggage that has. There is a column type called "boo" (for the sake of argument) in SQL, that Rails claims to support, but *apparently* the model is incorrect? (again, have we confirmed this is a bug, and not something I am doing wrong?) and doesn't fully support the "boo" column type? This seems like a rails bug in the "boo" type.
Interestingly though, it DOES let you set it correctly, and even print it, just when used in a select() box does it choke? -- David E. Cross On Fri, Nov 19, 2010 at 12:29 PM, Marnen Laibow-Koser <li...@ruby-forum.com>wrote: > pepe wrote in post #962618: > >> *wouldn't* I use a nullable boolean field for that? > > Certainly not very 'academic' but from Wikipedia's page > > http://en.wikipedia.org/wiki/Boolean_data_type: > > > > "In computer science, the Boolean or logical data type is the most > > primitive data type, having one of two values (true or false), > > intended to represent the truth values of logic and Boolean algebra." > > > > Why do I think boolean columns are a little different? You could > > interpret that null is 'similar' to false because it is not true, > > But I'm not. I think SQL has it right: null is neither false nor true. > > but > > that could also be the case the other way around. If you look a the > > issue from the perspective of "well, a boolean column is just a > > column", yes, I agree, there is no difference. However if you look at > > boolean columns from the perspective of their most likely reason to > > exist they are different because they imply that they will always > > contain a value, either true or false and null is neither. > > But that's not even true if we ignore the true 3-valued yes/no/maybe > case. The intent of SQL null is to represent *unknown* data. Imagine > storing data about your friends, including whether they own a car. You > might have a 'has_car' column, which would of course be boolean. > > Now, you may not know (because you haven't asked) whether some of your > friends own a car or not. So what to put in has_car? You can't put > true. You can't put false. Guess what, you put null! > > > That is > > different IMO than, for example, a date column, which could very > > possibly be conceived to contain either a date or no date at all. > > Could a boolean column be conceived to be null? > > Yes, absolutely. See above. > > > Certainly, but again, > > not the most likely case in my experience. > > But common enough. Don't pretend it doesn't happen. > > > > > Although an interesting proposition I don't think I would ever use a > > boolean column to store "true/false/maybe sort of things". > > Why not? > > > Of course, > > the column could be created to allow it but that, IMO, would defeat > > the purpose of the boolean column. > > No. SQL booleans are three-valued. It makes sense to use that > property. > > > I would rather use a different type > > because, as it happened to me in the past, a 'true/false/maybe' sort > > of scenario can quickly become a 'true/false/maybe/likely/not that > > likely/very likely' sort of scenario and then I would need to change > > my DB and code. > > Then change it *at that time*. You can't know what will happen in the > future, and therefore you can't really design for it. Remember YAGNI. > Don't overdesign. Don't anticipate if anticipation does not give you a > present benefit. > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > mar...@marnen.org > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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-t...@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.