I assure you that if my usage could have been modeled with 2 states instead
of 3, I would have disallowed "null" :)

Three value is _very_ useful.  If I have to move this to an integer type, I
will (yuck)... but really SQL allows this, the select-box allows this, it
works for OTHER data-types.  (I can have NULL dates that show up as blank in
date_select helpers.  I don't think anyone would suggest that I move to a
text type to support a null date, since NO date isn't a date!).

So, at this point, have we confirmed this is a bug?  Even within ruby, we
could model this as true/false/nil, right?

-- 
David E. Cross

On Fri, Nov 19, 2010 at 11:34 AM, Marnen Laibow-Koser
<li...@ruby-forum.com>wrote:

> pepe wrote in post #962590:
> >> [...]It's perfectly OK to have Boolean columns (or any columns)
> >> be null-capable if the semantics of the data dictate that.
> >
> > Sure. However, in my experience most people make boolean columns null
> > capable "just because" or because it's the default behavior of the DB
> [...]
>
> That may be.  For myself, I try to consider carefully whether I need
> null values in a particular field, and what they mean.  For booleans,
> three states are often useful.
>
> >
> > IMHO boolean columns are just a little different because of their very
> > nature.
>
> I don't see the difference.  Where do you see it?
>
> > Sure, they can be set to be null but I really don't see the
> > advantage in it.
>
> I've run across cases where something was best modeled by SQL-style
> 3-valued logic (for example, yes/no/maybe sorts of things).  Why
> *wouldn't* I use a nullable boolean field for that?
>
> > In my experience, if I set the column to default to
> > either true or false (probably false all the time) and change it as
> > needed things work much better and things get easier.
>
> For a true 2-valued boolean, that's also what I do.
>
> 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.

Reply via email to