On 30.10.2006 16:00, Leslie Viljoen wrote: > Hello > > I am processing database rows and I see that there are "bit" columns > that come out of ActiveRecord as true or false. I wanted binary digits > so I did this: > > class FalseClass > def to_i > 0 > end > end > > class TrueClass > def to_i > 1 > end > end > > .which may or may not be really dumb. So is it really dumb? Remember that a lot of other values are considered true so converting them will either not work (exception) or create all sorts of other weird effects if you try to generalize this pattern. I would prefer a custom conversion function def bit_int(x) x ? 1 : 0 end Kind regards robert